Hi,This is my sample datawith sample as ( select 1 as id, 20 as mark,0 as islabel union all select 2 as id, 20 as mark,1 as islabel union all select 3 as id, 30 as mark,0 as islabel union all select 4 as id, 30 as mark,1 as islabel union all select 5 as id, 40 as mark,0 as islabel union all select 6 as id, 40 as mark,1 as islabel union all select 7 as id, 40 as mark,0 as islabel union all select 8 as id, 50 as mark,1 as islabel union all select 9 as id, 40 as mark,0 as islabel union all select 10 as id, 50 as mark,1 as islabel )
Individual query:Select id,mark from sample where islabel = 0Select id,mark from sample where islabel = 1i need to join these two select based on marki need make self join on this and get the id who's score are equal.this is my trySELECT t1.id, t1.mark FROM sample t1 INNER JOIN sample t2 on (t1.mark = t2.mark) where t1.islabel = 0 and t2.islabel = 1
but his gives nothing.Expected output : 123456not sure what am i doing wrong. any suggestion please