Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL date range question

0 views
Skip to first unread message

bioni...@hotmail.com

unread,
Jan 4, 2007, 1:27:46 PM1/4/07
to
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?

bioni...@hotmail.com

unread,
Jan 4, 2007, 4:09:53 PM1/4/07
to
Putting "or gla_period=0" after where and before the and's without
parenthesis does the trick.

0 new messages