SELECT * from ( SELECT row_number() OVER(PARTITION BY c.Qymc ORDER BY kf.updateTime) as row, c.Qymc,ko.style,ko.keyword,ko.gsid,ko.id,CONVERT(VARCHAR(100),kf.updateTime,23) as updateTime FROM
KW_Order ko
LEFT JOIN KW_Fee kf on kf.orderID=ko.id
LEFT JOIN corporation c ON c.ID=ko.gsid
where ko.KM_FirstDays>0 and kf.sucType = 1 )s where row<=4
SELECT * from ( SELECT row_number() OVER(PARTITION BY c.Qymc ORDER BY kf.updateTime) as row, c.Qymc,ko.style,ko.keyword,ko.gsid,ko.id,CONVERT(VARCHAR(100),kf.updateTime,23) as updateTime FROM
KW_Order ko
LEFT JOIN KW_Fee kf on kf.orderID=ko.id
LEFT JOIN corporation c ON c.ID=ko.gsid
where ko.KM_FirstDays>0 and kf.sucType = 1 )s where row<=4