Take out an sql query from the following tables [duplicated]

0

Hello, good morning and I look forward to your help. I need to get out of the table

restaurant:

, from the table user:

and the user_type table

all those restaurants that do not belong to a user type of id = 1 (owner) in this case is 3 (empty restaurant name), because as you can see in the user table the id_restaurante of each user is either 1 or 2 especially those related to user_type 1 (owner)

I have not been consulting for a long time

    
asked by T P 20.05.2017 в 19:52
source

1 answer

0
SELECT
    REST.nombre AS restaurante,
    USU.nombre AS usuario,
    TIPO.descripcion AS Tipo
FROM
    restaurante AS REST
INNER JOIN usuario AS USU ON REST.id = USU.id_restaurante
INNER JOIN tipo_usuario AS TIPO ON USU.id_tipo_usuario = TIPO.id
AND TIPO.id > 1

Note: in the condition TYPE.id> 1 you can use other conditions such as NOT In or! =

    
answered by 20.05.2017 в 20:04