Avatar of meno19
meno19
 asked on

Multiple MySql AND Statements

I know the syntax is not correct. How would I go about using multiple and statements?

SELECT * FROM `search` WHERE company_name LIKE '%pizza%' 
and 
latitude BETWEEN 38.69852058020537 AND 41.224260426268195 
AND 
longitude BETWEEN -75.97329101562502 AND -75.97329101562502 
LIMIT 0, 25

Open in new window

MySQL ServerMicrosoft SQL Server

Avatar of undefined
Last Comment
johanntagle

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
johanntagle

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
meno19

ASKER
Sneaky Bastard doesn't throw and error. Sometimes the query runs and does not return results. It doesn't look to be the query its a glitch in how I'm triggering a search.
meno19

ASKER
Dammit i figured it out, bringing in the wrong number for the search
johanntagle

That confirms that the syntax is correct.  Maybe start with one clause first (the LIKE) and see if there are results.  Then add the latitude filter and see what's left, then add the last filter.
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23