Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Some Help with Select statement
Message
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00830332
Message ID:
00830387
Views:
15
Ah ... now I understand what you are trying to do. I'm sorry, I didn't read your original post close enough!!


>Ok I think I have the solution but could someone tell me if this is the best way of doing it.
>
>* ItemId 1 is The Times
>* ItemId 2 is The Sunday Times
>Select CustID from Subs ;
>where itemId=1;
>and CustId in (select CustId from Subs where itemId=2) ;
>and CustID Not IN (select distinct CustId from Subs where itemid NOT IN (1,2))
>
>
>>Hi all,
>>Is it possible to produce a single select statement to achieve the following:-
>>
>>If you have a Customers table (Id, Name), an Items table (Id, Name) and a Subscriptions table (CustomerID, ItemId). The Subscriptions table will hold a record for each Item that a Customer subscribes too.
>>
>>Is it then possible to get all the Customers who subscribe to a specified list of Items and NO others.
>>
>>ie If this is a paper round I want to find all those customers who take the Times and the Sunday Times and NO other papers.
>>
>>Its the NO other papers bit that has me stumped at the moment. Any help greatly appreciated.
>>Caroline
Cathy Pountney, Microsoft Visual FoxPro MVP
Memorial Business Systems, Inc. (www.mbs-intl.com)

My Website: (www.frontier2000.com)
My Blog: (www.cathypountney.blogspot.com)
My Book: The Visual FoxPro Report Writer - Pushing it to the Limit and Beyond
Free MSDN Article: What's New in the VFP 9.0 Report Writer
Free MSDN Article: The VFP 9.0 Report Writer In Action
Previous
Reply
Map
View

Click here to load this message in the networking platform