-3

I got 4 tables: galleries, areas, stores and gallery_element.

So I need to create a big query in which I could join the data(ex. name column) from galleries, areas, stores which are connected throug gallery_element table.

gallery_element has: id, gallery_id, area_id, store_id columns.

Can someone give me an simple example so I can practice with it further by myself.

Thanks!

Marinario Agalliu
  • 989
  • 10
  • 25

1 Answers1

2

I think it can help you to start your query:

select gallery_element.id, galleries.name, areas.name, stores.name from gallery_element
inner join galleries on galleries.id = gallery_element.galleries_id
inner join areas on areas.id = gallery_element.area_id
inner join stores on stores.id = gallery_element.store_id
Juranir Santos
  • 370
  • 2
  • 6