Re: anding across rows, how

From: Matt Wigdahl <mlwigdahl_at_yahoo.com>
Date: 15 Apr 2002 06:07:47 -0700
Message-ID: <f94322ea.0204150507.4f6ee576_at_posting.google.com>


stephen_james_at_uk2.net (Stephen James) wrote in message news:<dfd51415.0204130146.76b415cf_at_posting.google.com>...
> Given the data below how would I solve the following questions in SQL
> "What Customers have ordered both Carpets and Chairs and ..."
> "What Customers have ordered either Carpets and Chairs and ..."
> "What Customers have ordered an item like 'C%' and ..."
<snip>
>
> Given that I'm not sure how long the list of items to match across
> rows is what the best approach.
> * divided and conquer ?.
> * build sql on the fly ?.
> * do some quite marvellous SQL suggested by the world at large ?.
>
> I've a solution using a temp table and a cursor on a table holding the
> selection criteria but it's pig ugly and can't help but feel there is
> a
> better way.
>
> Thanks in advance for any suggestions.

I'd probably build the SQL dynamically. Sounds like you have to cover a large range of arbitrary WHERE clauses, so this would probably give you the best flexibility. Received on Mon Apr 15 2002 - 15:07:47 CEST

Original text of this message