How to combine two tables by means of sql queries? There is such a table:

CREATE TABLE [dolgnosty] ( [id] INTEGER PRIMARY KEY, [id_stavka] INTEGER, [dolgnost] VARCHAR(80)); 

This table should be attached to this:

 CREATE TABLE [stavky] ( [id] INTEGER PRIMARY KEY, [id_dolgnost] INTEGER, [id_point] INTEGER, [id_period] INTEGER, [stavka] FLOAT); 

Those. the dolgnosty table dolgnosty unchanged, and the stavky table stavky changing, but all this should be shown as one table! How to do it?

  • 2
    How does this question differ from your previous one? * [How to write a sql query that combines two tables?] [1] [1]: hashcode.ru/questions/35523 - angry

1 answer 1

 SELECT a.id, a.id_stavka, a.dolgnost, b.id AS stavki_id, b.id_point, b.id_period, b.stavka FROM table1 AS a LEFT JOIN table2 AS b ON b.id = a.id_dolgnost WHERE ...