Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 22nd, 2010, 06:39 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

And before you ask, let's show one more simple variation on that:
Code:
SELECT vendorName 
FROM Vendors 
WHERE vendorID IN (
      SELECT O.VendorID
      FROM Orders AS O, Customers AS C
      WHERE O.customerID = C.customerID 
        AND C.State IN('WA','OR','CA') ) 
AND vendorID NOT IN (
      SELECT O.VendorID
      FROM Orders AS O, Customers AS C
      WHERE O.customerID = C.customerID 
        AND C.State IN ('ME','NH','VT','MA','CT','RI') )
That gets all vendors who have sold in the 3 West Coast states but have never sold to any state in New England. Okay? You can see there are lots of ways to vary this.
The Following User Says Thank You to Old Pedant For This Useful Post:
03jh01 (December 22nd, 2010)
 
Old December 22nd, 2010, 07:42 PM
Registered User
 
Join Date: Dec 2010
Posts: 5
Thanks: 7
Thanked 0 Times in 0 Posts
Default

I cannot thank you enough for helping me out here. That is just what I needed (for you to go through one of the queries step by step)!

I have been programming C# for about 5 months now, and I would call myself intermediate in that at the moment. I think I should be in a position to advance to a higher level in SQL quite quickly... I hope :).

SQL looks quite simple on the face of it, but it's not until you start properly trying to learn it that you see that that isn't necessarily always the case.

As for the queries that took up 4 to 5 pages...woah. I would love to see those! What sort of queries are they? My naive SQL mind can't even imagine what you would be querying for it to take up that many pages :).

Anyway, thanks again, you couldn't have helped me out anymore if you tried.

See you around no doubt :).
 
Old December 22nd, 2010, 08:02 PM
Friend of Wrox
 
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

Sorry...can't show them to you. Proprietary. Briefly, they are stored procedures (so in reality maybe 10 different queries in one?) that do statistical analysis of time series data.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Which storage engine for "Post for sell goods" website taev MySQL 2 May 8th, 2009 02:53 PM
Sell more books Paulpdy BOOK: PHP and MySQL: Create-Modify-Reuse ISBN: 978-0-470-19242-9 6 February 5th, 2009 05:30 PM
who can help me to sell software laolai12 Flash (all versions) 0 June 18th, 2008 03:38 AM
cheap brand shoes sell saler VBScript 0 November 26th, 2007 07:12 AM
How to Sell PRODUCTS in the own site? Salar Beginning PHP 1 August 3rd, 2005 02:26 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.