well here's my query string:
---------------------
SELECT
CASE
WHEN TempObjekty.IdObjektu Is Not Null THEN TempObjekty.VzdialenostObjektValue
ELSE
CASE
WHEN TempObce.VzdialenostObecValue>=1000 THEN CONCAT(TempObce.VzdialenostObecValue/1000, ' km')
WHEN TempObce.VzdialenostObecValue=0 OR TempObce.VzdialenostObecValue Is Null THEN ''
ELSE CONCAT(TempObce.VzdialenostObecValue, ' m')
END
END,
FilterObjektovTbl.TypUbytovania,
FilterObjektovTbl.IdObjektu,
TempObce.IdObce,
TempObce.MenoObce
FROM
TempObce
INNER JOIN FilterObjektovTbl ON TempObce.IdObce = FilterObjektovTbl.IdObce
OUTER JOIN TempObjekty ON FilterObjektovTbl.IdObjektu = TempObjekty.IdObjektu
ORDER BY
CASE
WHEN TempObjekty.IdObjektu Is Not Null THEN VzdialenostSort
ELSE TempObce.VzdialenostObecValue
END
---------------------
i need outer join with condition
when i try to do the same like this, which i was told should act like i want, it returns everything from FilterObjektovTbl
FROM
FilterObjektovTbl
LEFT JOIN TempObce ON TempObce.IdObce = FilterObjektovTbl.IdObce
LEFT JOIN TempObjekty ON TempObjekty.IdObjektu = FilterObjektovTbl.IdObjektu
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.