Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Query with Empty Values

Status
Not open for further replies.

Mbowe

Programmer
Jan 6, 2006
35
Hello!
I need your help. I have field called 'country' which for US is blank. I want to select everything where country is not blank, not filtering.

Select Name.ID, Name.FirsName, Name.LastName, Name.Country
from tblMembers
where Name.Country<>'';

The code above does not filter, I also tried Name.Country Is Not Null.
 
Unfortunately did not work.
 
From your subject and the semicolon at the end of the command you posted, I'm guessing this isn't a Foxpro question. Is that right?
 
Before we continue to give you approaches to your problem which might not be applicable, you might help us with some clarification.

First, is the data source a non-Visual Foxpro table?
If so, these VFP commands which we are recommending might not work is the back-end data source does not recognize these commands.

Second, as Dan asked above, are you using Visual Foxpro or not for your application code?
Again, these VFP commands which we are recommending might not work.

Lastly, give us more detail when you say it "did not work".
* Do you get an error message upon execution?
* Or does the returned data records continue to erroneously contain blank Country field values?

Good Luck,
JRB-Bldr
 
In VFP, you can do it like this:

Code:
SELE Invoices.PN,QTY,LATEST;
FROM INVOICES;
  JOIN (SELECT PN, MAX(DATEBOT) AS Latest ;
          GROUP BY PN) Recent ;
    ON Invoices.PN = Recent.PN ;
    AND Invoices.Datebot = Recent.Latest ;

In earlier versions, you can use this:

Code:
SELE PN,QTY,DATEBOT LATEST;
FROM INVOICES;
  WHERE DATEBOT = ;
    (SELECT MAX(DATEBOT) FROM Invoices INV;
       WHERE INV.PN = Invoices.PN)

Tamar
 
I am not using VFP. And what I meant did not work is that it still returns the blank country. I will try to use

lcCountry = space(len(Name.Country))

and see if it works.
 

Mbowe,

I am not using VFP.[/u]

You would have saved us all a lot of time if you had mentioned that it in the first place. Or, better still, if you had posted your question in a more appropriate forum.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Hi, just to let you know that, when I tried just to select few fields:


select city, country from Name_Address where country<>''


it filtered as I want, so now I have to check what are the fields from the other table makes the error, probably I do something wrong on grouping. I appreciate all for your efforts.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top