Groups > Interbase > Interbase SQL > Re: Contact Age Query




Re: Contact Age Query

Re: Contact Age Query
Fri, 2 Nov 2007 18:48:42 -0500
Thanks for the information Bill.  That's too bad  :(   I guess this query
will have to remain unoptimized for now.

- Jason

"Bill Todd" <no@no.com> wrote in message 
news:472a977d$1@newsgroups.borland.com...
> The optimizer can use the index if you are selecting on the value in
> CBIRTHDAY, not on an expression that includes CBIRTHDAY. What you need
> is a query of the form:
>
> SELECT CONTACTID FROM CONSTACTS
> WHERE CBIRTHDAY < ...
>
> -- 
> Bill Todd (TeamB) 
Post Reply
Re: Contact Age Query
Fri, 2 Nov 2007 19:30:30 -0500
*Puts on dunce cap*

Yeah, you're right.  If I wanted all contacts age 47+, I could:

select CONTACTID from CONTACTS where CBIRTHDAY < '11/02/1960'

select CONTACTID from CONTACTS where CBIRTHDAY < ('Now' - ([Age X] * 365))
(Precalculate the date and put it in query string).

I should've thought of that, but that's why I ask the experts  :)  Problem 
solved.  Thanks everyone.
- Jason

"Wayne Niddery (TeamB)" <wniddery@chaffaci.on.ca> wrote in
message 
news:472bbdbe$1@newsgroups.borland.com...
> "Jason Summers" <jason@grinc.org> wrote in message 
> news:472bb775@newsgroups.borland.com...
>> Thanks for the information Bill.  That's too bad  :(   I guess this
query
>> will have to remain unoptimized for now.
>
> Why? Just change your query. Bill gave you a start.
>
>>> SELECT CONTACTID FROM CONSTACTS
>>> WHERE CBIRTHDAY < ...
>
> Use a parameter and pass an appropriate date.
>
> -- 
> Wayne Niddery - Winwright, Inc. (www.winwright.ca) 
Post Reply
Re: Contact Age Query
Fri, 2 Nov 2007 20:15:52 -0400
"Jason Summers" <jason@grinc.org> wrote in message 
news:472bb775@newsgroups.borland.com...
> Thanks for the information Bill.  That's too bad  :(   I guess this query
> will have to remain unoptimized for now.

Why? Just change your query. Bill gave you a start.

>> SELECT CONTACTID FROM CONSTACTS
>> WHERE CBIRTHDAY < ...

Use a parameter and pass an appropriate date.

-- 
Wayne Niddery - Winwright, Inc. (www.winwright.ca) 
Post Reply
about | contact