sql - MySQL: Query form two separate ID lists and make one unified list, without duplicate values -
i have table below , trying merge block user , block columns , remove intersect values , create list of unique numbers, literally failing specific users block list.
|------------------------------------------------------ |block_id | block_user | block_by | block_at |------------------------------------------------------ | 1 | 22 | 1 | 1434451573 | 7 | 59 | 1 | 1434695298 | 10 | 4 | 1 | 1434695327 | 11 | 1 | 14 | 1434695349
i need following, needs query id of 1 ;
|----------- |block_list |----------- | 4 | 14 | 22 | 59
i trying sql following , literally failed desired results;
select block_user blocked_user block_list union select block_by blocked_list block_list (block_user = '1' or block_by = '1')
if 1 excluded can use this:
select * ( select block_user id yourtable union select block_by id yourtable ) dat dat.id <> 1
maybe want add where block_user = 1
subquery if it's needed in logic. wasn't clear.
Comments
Post a Comment