mysql - PHP echo out id with the same value -


i have table

enter image description here

what want query/echo out id same value example id 1 , id 3 has same value. possible in same table , column? thanks!

you can use self-join pairs of ids same weight

select t1.weight, t1.id id1, t2.id id2 yourtable t1 join yourtable t2 on t1.weight = t2.weight , t1.id < t2.id 

or group_concat ids same weight in single row:

select weight, group_concat(id) ids yourtable group weight having count(*) > 1 

to 1 pair each weight:

select t1.weight, t1.id id1, t2.id id2 yourtable t1 join yourtable t2 on t1.weight = t2.weight , t1.id < t2.id group t1.weight 

demo


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -