最好能用一条语句实现,我的具体应用要更复杂一下 最好能用一条语句实现,我的具体应用要更复杂一些 SQL code: SELECT * from TB T WHERE NOT EXIXTS(SELECT 1 from TB WHERE cid=T.cid AND procuctprice>T.procuctprice)
SQL code: --加上排序 SELECT * from TB T WHERE NOT EXIXTS(SELECT 1 from TB WHERE cid=T.cid AND procuctprice>T.procuctprice) ORDER BY procuctprice DESC
SQL code: select a.* from procucts a where not exists (select 1 from procucts where cid=a.cid and procuctprice>a.procuctprice) order by a.procuctprice desc
SQL code
Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/