[SQL ] MYSQL如何組合唯一化?

看板Database作者 (寂靜西風)時間17年前 (2008/05/22 23:04), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
使用版本 MySQL 5.0.51 table1 id group1 name1 type1 1 A aaa Write 2 A bbb Report 3 A ccc Read 4 B ddd Write 5 B eee Read 6 B fff Report 7 C ggg Write 將他們組合出來看他們組合類型是如何 我的SQL SELECT a.type1 as Type1 , b.type1 as Type2 , count(*) as total FROM `table1` a, `table1` b WHERE a.group1=b.group1 AND a.name1 != b.name1 Group by a.type1 Order by 3 可是卻會輸出 Type1 Type2 Count Write Report Write Read Read Write Read Report Report Read Report Write (下略) 類似這樣的結果 可是我想要的是 Type1 Type2 Write Report Write Read Report Read 意思是 (Write, Report) = (Report, Write) 這樣MySQL可以辦到嗎@@? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 218.165.78.122
文章代碼(AID): #18DOjlY8 (Database)
文章代碼(AID): #18DOjlY8 (Database)