select soct.Captcha,CreateOn,* from SceneryOrderCheckTicket soct
right join
(
SELECT Captcha,convert(char(10),CreateOn,120) as createdate FROM dbo.SceneryOrderCheckTicket
where CreateOn>'2014-01-01' and Ord in(1,2,3,4)
group by Captcha,convert(char(10),CreateOn,120)
HAVING COUNT (Captcha)>1 ) ss on soct.Captcha=ss.Captcha
where CreateOn>'2014-01-01' and Ord in(1,2,3,4)
order by soct.Captcha
alter table MonthEnd_Unit
add MEU_IsImport bit null default(0)
go
EXEC sys.sp_addextendedproperty @name=N'MS_Description',
@value=N'是否是导入的月结' , @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'MonthEnd_Unit',
@level2type=N'COLUMN',@level2name=N'MEU_IsImport'
go