Re: [SQL ] 同一資料表內之查詢
※ 引述《hukhuk (ken)》之銘言:
: select a.* from product a
: inner join product b on a.manufactures=b.manufactures
: where a.company<>b.company
: group by a.company
: order by a.manufactures,a.company;
如果有個 7 乙 f n3
這個query會有問題
group by的後面應該多加個a.manufactures
然後order再改一下
變成
select a.* from product a
inner join product b on a.manufactures=b.manufactures
where a.company<>b.company
group by a.company, a.manufactures
order by a.manufactures,a.id;
--
http://blog.carlcarl.tw
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.242.43.148
討論串 (同標題文章)