;WITH TT
AS(
SELECT ROW_NUMBER() OVER(PARTITION BY unitfName ORDER BY devid) AS NO ,
unitfName,devid,VEHNO,PCOLOR,VTYPE,VSTATUS,BSNSRANGE,BRAND,OWNER,
OWNERTEL,DESCRIBE,INSTALLOR,DRIVER,unitfName as c
FROM getORIG_VEHICLES())
SELECT CASE WHEN no =1 THEN unitfName ELSE '' END AS unitfName,devid ,VEHNO,PCOLOR,VTYPE,VSTATUS,BSNSRANGE,BRAND,OWNER,
OWNERTEL,DESCRIBE,INSTALLOR,DRIVER,unitfName as c
FROM TT ------最佳解决方案-------------------- ;WITH TT
AS(
SELECT ROW_NUMBER() OVER(PARTITION BY unitfName ORDER BY devid) AS NO ,
unitfName,devid,VEHNO,PCOLOR,VTYPE,VSTATUS,BSNSRANGE,BRAND,OWNER,
OWNERTEL,DESCRIBE,INSTALLOR,DRIVER,unitfName as c
FROM getORIG_VEHICLES())
SELECT CASE WHEN no =1 THEN unitfName ELSE '' END AS unitfName,devid ,VEHNO,PCOLOR,VTYPE,VSTATUS,BSNSRANGE,BRAND,OWNER,
OWNERTEL,DESCRIBE,INSTALLOR,DRIVER,unitfName as c
FROM TT
where NO between 0 and 20 ------其他解决方案-------------------- 既然查询都写好了,直接加个条件就行了 ------其他解决方案-------------------- ;WITH TT
AS(
SELECT ROW_NUMBER() OVER(PARTITION BY unitfName ORDER BY devid) AS NO ,
unitfName,devid,VEHNO,PCOLOR,VTYPE,VSTATUS,BSNSRANGE,BRAND,OWNER,
OWNERTEL,DESCRIBE,INSTALLOR,DRIVER,unitfName as c
FROM getORIG_VEHICLES())
SELECT CASE WHEN no =1 THEN unitfName ELSE '' END AS unitfName,devid ,VEHNO,PCOLOR,VTYPE,VSTATUS,BSNSRANGE,BRAND,OWNER,
OWNERTEL,DESCRIBE,INSTALLOR,DRIVER,unitfName as c
FROM TT
where NO between 0 and 20
顶一下 阿汤哥
------其他解决方案-------------------- 该回复于2012-10-20 10:30:49被版主删除 ------其他解决方案-------------------- 加上这个还是不对 where NO between 0 and 20