E
E
Egor2016-09-12 16:18:50
SQL
Egor, 2016-09-12 16:18:50

How is a query to fetch unique sql values?

It is necessary to display the user id only from the system, for example "a". Ie it will be "56". Help make a request.
For example, the table:
User_id _______ System
23 ______________ a
23 ______________ b
34 ______________ a
34 ______________ b
34 ______________ c
56 ______________ a
I updated the conditions, there was an error.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
entermix, 2016-09-12
@Egor25

What? oo
dev.mysql.com/doc/refman/5.7/en/distinct-optimizat...
UPD:
UPD 2:
Something like this:

SELECT User_id as u_id FROM table WHERE System = 'c' AND NOT EXISTS (SELECT User_id FROM table WHERE User_id = u_id AND System <> 'c')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question