how do this line in mysql any make and any model…
m.make_parent = $make AND c.model = m.ID
below…well?
currently works only if particular make and model have values…
you think if exclude
LEFT OUTER JOIN make m
ON m.make_parent = $make AND c.model = m.ID
in case both are any should work?
I tried but fails
$ttQuery = "SELECT
c.*, DATE_FORMAT(c.SYS_CREATION_DATE,'%d-%b-%y') AS creationDate, p.id as promoID
FROM
cars c
LEFT OUTER JOIN promo p
ON c.ID = p.ID
LEFT OUTER JOIN make m
ON m.make_parent = $make AND c.model = m.ID
$searchCondition
ORDER BY ....................
if you are using a front end language like php, you would test for the $make value, and if it’s missing (which means "any"make) then you would exclude that from the sql
so if there is a $make, then your query should look like this –
FROM cars c
LEFT OUTER
JOIN promo p
ON p.ID = c.ID
LEFT OUTER
JOIN make m
ON m.ID = c.model
AND m.make_parent = $make
and if there is no $make value, then your query should look like this –
FROM cars c
LEFT OUTER
JOIN promo p
ON p.ID = c.ID
LEFT OUTER
JOIN make m
ON m.ID = c.model
it did not work
what if put unequal “” the make…how to??? I think both required // currently works if select make/model or make alone,… it does not work if select nothing in drop downs.both “”