K
K
Kolya Vantukh2016-11-16 20:59:29
PHP
Kolya Vantukh, 2016-11-16 20:59:29

How to form the correct sql query?

Have a request

SELECT * FROM table WHERE `status` = 'maubert' and`AssosUser` in ('LAROQUE','N.C.') and `telepro` in ('DENIS','MANGEL','MORANGE')

The output is this . It is
c05160200cdb4f88980a0716887ea99c.png
necessary to form a query so that "DENIS" is displayed only with AssosUser = LAROQUE , and others (MANGEL','MORANGE) with AssosUser = LAROQUE and AssosUser = NC
How to do this? really need help please

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Immortal_pony, 2016-11-16
@vkolya

SELECT * 
FROM `table`
WHERE `status`='maubert' 
AND (
    (`AssosUser`='LAROQUE' AND `telepro`='DENIS') OR
    (`AssosUser` IN ('LAROQUE', 'N.C.') AND `telepro` IN ('MANGEL', 'MORANGE') 
);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question