BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SQL date range question

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Fri Jan 05, 2007 12:27 am    Post subject: SQL date range question Reply with quote



I'm using Local SQL/Paradox with Delphi 7.
I have a pretty simple query where i'm filtering the records by date
and account #.

Sql.Add('and gla_date >=
'+QuotedStr(GetSQLDate(DateToStr(dtpFromDate.Date))));
Sql.Add('and gla_date <=
'+QuotedStr(GetSQLDate(DateToStr(dtpToDate.Date))));
Sql.Add('and gla_accnt >= '+From_account.Text);
Sql.Add('and gla_accnt <= '+To_account.Text);

This returns everyhting within the date and account ranges.

The problem is that I do not want records where gla_period=0 to be
filtered by date, I want those results returned even if the date of
those records is outside of the the date range.
Is there any way this can be accomplished?
Back to top
Guest






PostPosted: Fri Jan 05, 2007 3:09 am    Post subject: Re: SQL date range question Reply with quote



Putting "or gla_period=0" after where and before the and's without
parenthesis does the trick.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (Desktop) All times are GMT
Page 1 of 1

 
Jump to:  
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
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.