Hello guys,
this is my query with two left joins (tried to join bcompany - main table WITH bpoint and bug):
SELECT cName, cAddr, sName, uNaslov FROM bcompany c LEFT JOIN bpoint p ON c.companyID = p.companyID LEFT JOIN bug b ON c.companyID = b.cID WHERE c.companyID='$cID';
First table bcompany is a main one, and there is always exactly one result row.
Both tables bpoint and bug relate to bcompany via the companyID column. These two tables will not necessarily have any records.
Thats why i used left joins, to always get the information of bcompany table no matter if there are any results in other tables or not.
My problem are doubled results of those two joined tables. I can understand multiple results for the main table, but not for the joined two.
How can i get rid of them?
Output:
bcompany:
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
Mladi Tehnik d.o.o.
bpoint:
Stari Tehnik
Stari Tehnik
Stari Tehnik
Pizzerija 5ka
Pizzerija 5ka
Pizzerija 5ka
Gostilna Kekec
Gostilna Kekec
Gostilna Kekec
Blejski Tehnik
Blejski Tehnik
Blejski Tehnik
bug:
Testna 1
Testna 2
Mickino kolo
Testna 1
Testna 2
Mickino kolo
Testna 1
Testna 2
Mickino kolo
Testna 1
Testna 2
Mickino kolo