Query with two tables

0

I'm in a project, I have the client and work table. A job has a customer. I have already listed the tables, but I need to do a select that from the client id in the work table, return the client name.

I have to make a query to display in my code in php.

Can anyone help me please?

    
asked by anonymous 16.05.2016 / 18:18

1 answer

2

Assuming your tables look like this:

CLIENT     id int,     client_name VARCHAR

WORK     id int     int_identifier     VARCHAR working_description

You could do this:

SELECT a.id, a.descr_trabalho, b.nome_cliente from TRABALHO a 
    left join CLIENTE b on
       a.id_cliente = b.id
    
16.05.2016 / 19:05