0
I have the following query (after all logic, ie the final query)
SELECT *
FROM cl_assistance AS CA
LEFT JOIN cl_assistance_rel AS CREL ON CA.cod_assistance = CREL.rel_assistance
WHERE latitude
BETWEEN -24.22070591
AND -22.88033389
AND longitude
BETWEEN - 47.30349541
AND - 45.96312339
What I need help with is that on the table cl_assistance_rel
there is the foreign key rel_type which references in cl_assistance_type
the type of assistance.
Then there are 3 support options that comes in GET
the request "Air-conditioners", "Stoves" and "Washers" (in code form).
So I need to include the query parameters:
CREL.rel_type = '1' OR
CREL.rel_type = '2' OR
CREL.rel_type = '3'
That is, first I take all posts within the given area, then I select the ones that fit the types of assists.
In case I join these two querys, I end up taking all the posts.
I’m not sure I understand, but try to add this at the end:
AND CREL.rel_type IN (1,2,3)
– bfavaretto