D
D
devhub162018-02-08 00:05:40
MySQL
devhub16, 2018-02-08 00:05:40

How to write a SQL query correctly?

Hello! There is such task: there is a table with records in which there is a uid field. This field can have both negative and positive values. There are two more tables: one for groups, the other for users, which have a blocking field.
The problem is in composing the query: you need to select records from the first table, and if the uid field is negative, multiply it by (-1) and check in the second table for groups (I understand that through NOT IN) so that the lock is equal to 0. If uid is positive, do the same check, but only in the table for users.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2018-02-08
@dimonchik2013

no one has left JOIN yet

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question