日期:2014-05-20 浏览次数:20768 次
----创建表---- CREATE TABLE [dbo].[T_HOS_DOCHOSCONNECTION]( [ID] [int] IDENTITY(1,1) NOT NULL, [DOCID] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [DOCNAME] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [HOSPITALID] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, [HOSPITALNAME] [varchar](50) COLLATE Chinese_PRC_CI_AS NOT NULL, CONSTRAINT [PK_T_HOS_DOCHOSCONNECTION] PRIMARY KEY CLUSTERED ( [ID] ASC )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY]
-----添加测试数据------ insert into t_hos_DocHosconnection select '1','张三','032200-01','山西医科大学附属汾阳医院' union all select '2','李四','032200-01','山西医科大学附属汾阳医院' union all select '3','王五','032200-01','山西医科大学附属汾阳医院' union all select '4','赵六','101500-02','密云县中医院' union all select '5','赵六','101500-02','密云县中医院' union all select '6','马奇','150001-02','哈尔滨工业大学医院' union all select '7','赵兵','150001-02','哈尔滨工业大学医院' union all select '8','马龙','6121000-01','峨嵋红会医院' union all select '9','李文','6121000-01','峨嵋红会医院'
(from model in dic where model.HOSPITALID == hospitalid select new { hospitalid = model.hospitalid, hospitalname = model.hospitalname }).Distinct();
------解决方案--------------------