|
Posted by Simon Hayes on 07/08/05 20:15
"jqq" <jqq@myrealbox.com> wrote in message
news:1120839746.620891.96250@f14g2000cwb.googlegroups.com...
> SQL2K on W2Kserver
>
> I need some help revamping a rather complicated query. I've given the
> table and existing query information below. (FYI, changing the
> database structure is right out.)
>
> The current query lists addresses with two particular types
> ('MN30D843J2', 'SC93JDL39D'). I need to change this to (1) check each
> contact for address type 'AM39DK3KD9' and then (2) if the contact has
> type 'AM39DK3KD9' select types ('AM39DK3KD9', 'ASKD943KDI') OR if the
> contact does not have that type then select types ('MN30D843J2',
> 'SC93JDL39D'). (Context - the current query selects two standard
> address types "Main" and "Secondary"; we've added new data and now have
> types "Alternate Main" and "Alternate Secondary". If the Contact has
> Alternate addresses, I need to select those; if not, I need to select
> the standard addresses. There are other address types in use, so I
> must specify which types to select.)
>
> Can anyone point me in the right direction?
>
> Thanks very much! jamileh
>
<snip>
The short answer is probably to see CASE in Books Online. If you need more
information, I suggest you provide some INSERT statements for sample data,
and also the output you expect - it's not very clear (to me) exactly what
your query should return.
http://www.aspfaq.com/etiquette.asp?id=5006
Simon
[Back to original message]
|