mysql - One-to-many connection, several tables sql -


i've got tables

tech_map (17 rows): id,name,status, id_user_add, datetime_add, commentary

tech_map_expenses (7 rows): id,name,cost, tech_map.id

tech_map_products (8 rows): id,category_id,catalog_id, total, tech_map_id

tech_map_stock (8 rows): id,category_id,catalog_id, total, tech_map_id

and want select tech_map exits connection other tables example:

select tech_map.*   `tech_map` inner join tech_map_expenses on tech_map_expenses.tech_map_id = tech_map.id inner join tech_map_products on tech_map_products.tech_map_id = tech_map.id inner join tech_map_stock on tech_map_stock.tech_map_id = tech_map.id  order tech_map.id desc  

but it's return many rows (33) duplicate records.

you should change left join inner join. why?

  • left join contain tech_map doesnt have connection other tables.

  • inner join contain tech_map have connection other tables.

take @ picture, me. , also, documentation.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -