Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 756
  • Last Modified:

MySQL SQL Syntax question exclude data

I am using the following SQL query to pull matching data.  Some of the results may not have data for fields sLatitude and sLongitude.  How do I exclude these records when these fields are empty in my SQL query?
SELECT * FROM Residential, property_coordinates
        WHERE sSubdivision='Pines'
        AND Residential.sMLSNumber=property_coordinates.sMLSNumber

Open in new window

0
pda4me
Asked:
pda4me
2 Solutions
 
dportasCommented:
Assuming that "empty" means "null", do:

SELECT *
        FROM Residential, property_coordinates
        WHERE sSubdivision='Pines'
        AND Residential.sMLSNumber=property_coordinates.sMLSNumber
        AND sLatitude IS NOT NULL
        AND sLongitude IS NOT NULL ;
0
 
albuitraCommented:
Try with this
SELECT * FROM Residential, property_coordinates
        WHERE sSubdivision='Pines'
        AND Residential.sMLSNumber=property_coordinates.sMLSNumber
AND sLatitude is not NULL and sLatitude != '' 
and sLongitude is not NULL and sLongitude != ''

Open in new window

0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now