469,935 Members | 1,792 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,935 developers. It's quick & easy.

WHERE clause delima

I need to get all rows that are between two dates. I need to look at
the updated_date column and if it is null then look at the created_date
column.

I considered doing this with a function, but as I understand it,
functions should be avoided in the WHERE clause.

What else can I do to accomplish the same thing?

WHERE (td.tkt_flag=''C'' OR td.tkt_flag=''V'') AND td.uploaded=0
AND (co.updated_date BETWEEN @start_date AND @end_date)

Thanks for any help.
Mike

Jul 23 '05 #1
1 962

<my*********@yahoo.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I need to get all rows that are between two dates. I need to look at
the updated_date column and if it is null then look at the created_date
column.

I considered doing this with a function, but as I understand it,
functions should be avoided in the WHERE clause.

What else can I do to accomplish the same thing?

WHERE (td.tkt_flag=''C'' OR td.tkt_flag=''V'') AND td.uploaded=0
AND (co.updated_date BETWEEN @start_date AND @end_date)

Thanks for any help.
Mike


Perhaps something like this?

WHERE (td.tkt_flag=''C'' OR td.tkt_flag=''V'') AND td.uploaded=0
AND (COALESCE(co.updated_date, co.created_date) BETWEEN @start_date AND
@end_date)

Simon
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

47 posts views Thread by Andrey Tatarinov | last post: by
2 posts views Thread by steve | last post: by
3 posts views Thread by A.V.C. | last post: by
2 posts views Thread by Jim.Mueksch | last post: by
5 posts views Thread by pwiegers | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.