简体   繁体   中英

Write SQL Query to get Expected Output

i'm trying to get this expected output but its not getting for me... this is my sql query i don't understand how to get only Those ID whose belongs to 100000006

在此处输入图片说明

select * from friendlist 
         where userid = '100000006' or frienduserid='100000006' and frndstatuid='4'
select * from friendlist 
         where (userid = '100000006' or frienduserid='100000006') and frndstatuid='4'
SELECT DISTINCT userid
FROM friendlist
WHERE frienduserid='100000006' AND frndstatuid='4'
UNION ALL
SELECT DISTINCT frienduserid
FROM friendlist
WHERE userid='100000006' AND frndstatuid='4'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM