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 in the cl_assistance_rel
table there is the foreign key rel_type that references the cl_assistance_type
the type of assistance.
Then there are 3 support options that come in GET
of the requisition "Air conditioners", "Stoves" and "Lavadouras" (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 get all the posts within the given area, then I select the ones that fit the types of assists.
In case I join these two queries, I end up picking up all the posts.