Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Search Forums
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Showing results 1 to 7 of 7
Search took 0.02 seconds.
Search: Posts Made By: 03jh01
Forum: SQL Language December 22nd, 2010, 06:39 PM
Replies: 12
Views: 1,463
Posted By Old Pedant
And before you ask, let's show one more simple...

And before you ask, let's show one more simple variation on that:

SELECT vendorName
FROM Vendors
WHERE vendorID IN (
SELECT O.VendorID
FROM Orders AS O, Customers AS C
WHERE...
Forum: SQL Language December 22nd, 2010, 06:24 PM
Replies: 12
Views: 1,463
Posted By Old Pedant
Trivial change to prior query: SELECT vendorName...

Trivial change to prior query:
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...
Forum: SQL Language December 22nd, 2010, 05:12 PM
Replies: 12
Views: 1,463
Posted By Old Pedant
Once you give an alias to a table (e.g, "Orders...

Once you give an alias to a table (e.g, "Orders AS O") you can no longer use the full table name to refer to fields.

So if the code does "Orders AS O" then you need to use "O.VendorID"

For the...
Forum: SQL Language December 22nd, 2010, 03:40 PM
Replies: 12
Views: 1,463
Posted By Old Pedant
CAUTION: None of these queries are going to be...

CAUTION: None of these queries are going to be very efficient unless you have the right indexes in place!! What are "right indexes"? It depends on the DB. MySQL is especially fussy about indexes...
Forum: SQL Language December 22nd, 2010, 03:38 PM
Replies: 12
Views: 1,463
Posted By Old Pedant
That's tougher. Hmmm... SELECT...

That's tougher. Hmmm...

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 = 'NY'...
Forum: SQL Language December 22nd, 2010, 03:29 PM
Replies: 12
Views: 1,463
Posted By Old Pedant
Read the *FULL* sub-query: SELECT DISTINCT...

Read the *FULL* sub-query:

SELECT DISTINCT O.VendorID
FROM Customers AS C INNER JOIN Orders AS O
ON ( O.customerID=C.customerID AND C.State='NY' )
The vendorID is *NOT* coming from the...
Forum: SQL Language December 21st, 2010, 08:16 PM
Replies: 12
Views: 1,463
Posted By Old Pedant
You don't say what DB you are using, but I think...

You don't say what DB you are using, but I think this query should work in most anything but poor little Access:

SELECT V.vendorName
FROM Vendors AS V
LEFT JOIN (
SELECT DISTINCT O.VendorID
...
Showing results 1 to 7 of 7

 


All times are GMT -4. The time now is 09:00 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.