select b.name,c.name
from pro as b,(select a.name , a.product
from pro as a) as c
where b.product= c.product
and b.name!=c.name
ได้ประมานนี้แล้ว แต่จะเอา AB เหมือนกะ BA นี่จะเอาออกตัวนึงยังไงอ่ะ
A B
B A
A C
C A
B C
C B
D E
E D
Date :
2011-06-23 22:20:36
By :
pinkladyz
No. 2
Guest
เห่อๆเข้ามาลองตอบเผื่อถูก Code (PHP)
select name1,name2 from
(select a.name as name1,b.name as name2 from pro as a
left join pro as b on a.name<>b.name and a.product=b.product) as c
group by ascii(name1)+ascii(name2)
select name1,name2 from
(select a.name as name1,b.name as name2 from pro as a
left join pro as b on a.name<>b.name and a.product=b.product) as c
group by ascii(name1)+ascii(name2)