有一张项目表
CREATE TABLE [ProjectTable] (
[ProjectID] NVARCHAR(16) NOT NULL,
[ProjectName] NVARCHAR(20) NOT NULL ON CONFLICT REPLACE DEFAULT Null,
[DeviceID] INTEGER(16) NOT NULL ON CONFLICT FAIL,
[Description] NVARCHAR(255) NOT NULL ON CONFLICT REPLACE DEFAULT 工程描述);
使用一下的sql语句
select distinct a.[ProjectID], a.[ProjectName] from projecttable as a
得出的结果为
其实想要的数据,只是不同的ProjectID所对应的ProjectName
修改sql语句为
select distinct a.[ProjectID], a.[ProjectName] from projecttable as a group by a.[ProjectID]
时间: 2024-11-06 15:11:39