M
M
Maxim2018-04-19 14:58:58
MySQL
Maxim, 2018-04-19 14:58:58

How to use if or other check in a query?

The bottom line is we take a bunch of fields
SELECT orders, users, ....
FROM .....
WHERE
and here we need to do something, if IF client.contact = 'phone' && client.r !='' then client.r = user.id
is it possible to do this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2018-04-19
@xiiicool

SELECT 
  IF(client.contact = 'phone' AND client.r <>'', user.id, client.r) as value ...
FROM ...
WHERE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question