Solved

MySQL SQL Syntax question exclude data

Posted on 2008-06-18
2
751 Views
Last Modified: 2013-12-12
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
Comment
Question by:pda4me
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 22

Assisted Solution

by:dportas
dportas earned 50 total points
ID: 21812645
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
 
LVL 4

Accepted Solution

by:
albuitra earned 450 total points
ID: 21812660
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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
This article discusses how to create an extensible mechanism for linked drop downs.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question