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
ASKER CERTIFIED SOLUTION
Avatar of johanntagle
johanntagle
Flag of Philippines image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of meno19
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.
Avatar of meno19
meno19

ASKER

Dammit i figured it out, bringing in the wrong number for the search
Avatar of johanntagle
johanntagle
Flag of Philippines image

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.
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo