Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Fri May 25, 2018 5:30 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Select Where Field is Nil ?
PostPosted: Thu Mar 21, 2013 2:03 pm 
Offline
User avatar

Joined: Wed Feb 01, 2012 3:06 pm
Posts: 68
My application is using a RealSQL Database to store information.

There are several fields in each record and I am trying to retrieve records where a specific field is blank (or Nil).

If I use a statement like:
log_rs = G_Log_DB.SQLSelect( "SELECT * FROM Log_DB" )

Then I can step through each record in the set and process the record if a specific field (e.g. Log_DXCC) is blank:
If log_rs.Field( "Log_DXCC" ).StringValue = "" THEN...

However, I'd like to SELECT only those specific records in the SELECT Statement.

Using a statement like:
log_rs = G_Log_DB.SQLSelect( "SELECT * FROM Log_DB WHERE UPPER(Log_DXCC) = '' " ) returns no records.

How do I format a SELECT Statement to return only those records where a specific field is Nil (or blank) ?

Ron Bower
Ellicott City, MD

_________________
Ron Bower
Ellicott City, MD


Top
 Profile  
Reply with quote  
 Post subject: Re: Select Where Field is Nil ?
PostPosted: Thu Mar 21, 2013 2:09 pm 
Offline
User avatar

Joined: Wed May 10, 2006 2:42 pm
Posts: 2985
Location: Germany
Select * from Log_DB where Log_DXCC is NULL
or
Select * from Log_DB where Length(Log_DXCC) = 0
or
Select * from Log_DB where (Length(Log_DXCC) = 0 OR Log_DXCC IS NULL)

depending on which database, you need to use the right one.
For SQLite, I think you could simply test for NULL.

Greetings
Christian

_________________
See you in Orlando, Florida for Real World 2013
More details and registration here:
http://www.realsoftware.com/community/realworld.php


Top
 Profile  
Reply with quote  
 Post subject: Re: Select Where Field is Nil ?
PostPosted: Thu Mar 21, 2013 2:12 pm 
Offline
User avatar

Joined: Fri Jun 05, 2009 11:50 am
Posts: 348
Location: Hamburg, Germany
select from table where field is null

Edit says: Sh*t, way to slow

_________________
Best regards

Stefan

Mac OSX Mountain Lion (latest Release) on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 Release 3


Top
 Profile  
Reply with quote  
 Post subject: Re: Select Where Field is Nil ?
PostPosted: Thu Mar 21, 2013 2:38 pm 
Offline
User avatar

Joined: Wed Feb 01, 2012 3:06 pm
Posts: 68
Bingo !!!

Many thanks for the quick replies.

Simple once you get the right syntax.

_________________
Ron Bower
Ellicott City, MD


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group