This is my sql query:
SELECT DISTINCT
k.*, m.title as city, w.title as state
FROM
konta__kategoria kat, konta k
INNER JOIN
miejscowosci as m ON k.miejscowosc = m.id
INNER JOIN
wojewodztwa as w ON k.wojewodztwo = w.id
LEFT JOIN
kategorie as cat ON cat.id = kat.kategoria
WHERE
kat.kategoria IN (1610,1609,1608,1607,1606,1605,1611,1612,1613,1614,1615,1616,1617,1618,1619,1620,1621,1622,1623,1624,1625,1626,1627,1628,1629,1630,1631,1632,1633,1634,1635,1636,1637,1638,1639,1640,1641,1642,1643,1644,1645,1646,1647,1648,1649,1650,1651,1652,1653,1654,1655,1656,1657,1658,1659,1660,1661,1662,1663,1664,1665,1666,1667,1668,1669,1670,1671,1672,1673,6)
AND kat.parent_id = k.id
AND k.dsc LIKE "%%"
AND deleted = 0
ORDER BY
k.nazwa
I'm getting error:
#1054 - Unknown column 'kat.kategoria' in 'on clause'
It's working when I remove
LEFT JOIN kategorie as cat ON cat.id = kat.kategoria
But I know that kat.kategoria exist (it's working in where), also there exist table cat.id, so what is the problem?
JOINsyntax in the exact same query. Why would you do that?SELECT DISTINCT kat.kategoria FROM konta__kategoria kat?kategorie as cat? It seems you don't use that table at all.