I am going to put inside cust_info are null cust_id select out the result is 124125, not 123, because 123 has a cust_info have value,
I think of is empty cust_id left join value cust_id,
Want to ask is there more simplified way, thanks for the great god ~ ~
CodePudding user response:
Don't know what you need to format, wrote two, you see which is you need to,The SELECT tc ust_id FROM (
The SELECT tc ust_id, MAX (tc ust_info) m the FROM (
SELECT '123' cust_Id, 'food' cust_info FROM DUAL UNION ALL
SELECT '123', NULL FROM DUAL UNION ALL
SELECT '124', NULL FROM DUAL UNION ALL
SELECT '125', NULL FROM DUAL) t GROUP BY tc ust_id) t WHERE t.m IS NULL.
The SELECT GROUP_CONCAT (tc ust_id) FROM (
The SELECT tc ust_id, MAX (tc ust_info) m the FROM (
SELECT '123' cust_Id, 'food' cust_info FROM DUAL UNION ALL
SELECT '123', NULL FROM DUAL UNION ALL
SELECT '124', NULL FROM DUAL UNION ALL
SELECT '125', NULL FROM DUAL) t GROUP BY tc ust_id) t WHERE t.m IS NULL.
CodePudding user response:
Select * from table where cust_info is null