Answer the question
In order to leave comments, you need to log in
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
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question