Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > BOOK: SQL Functions Programmer's Reference
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: SQL Functions Programmer's Reference
This is the forum to discuss the Wrox book SQL Functions Programmer's Reference by Arie Jones, Ryan K. Stephens, Ronald R. Plew, Robert F. Garrett, Alex Kriegel; ISBN: 9780764569012
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: SQL Functions Programmer's Reference 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
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 10th, 2011, 07:48 PM
Registered User
 
Join Date: Jun 2011
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Thumbs up Logic for correlated subquery

hi i want to know the logic of this query..i mean how data flows.....
i want to know what do the
where subtotal <=
please help me to understand this with the help of dfd if necessary


USE AdventureWorks
SELECT TerritoryID, SubTotal, SalesPersonID, SalesOrderID
FROM Sales.SalesOrderHeader AS SO1
WHERE SubTotal <= (SELECT MAX(SO2.SUBTOTAL) FROM Sales.SalesOrderHeader AS SO2
WHERE SO1.TerritoryID = SO2.TerritoryID
AND SO1.SubTotal < = SO2.SubTotal
HAVING COUNT(SubTotal) <= 5)
ORDER BY TerritoryID,SubTotal DESC;
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Do i have to use a subquery, if yes then how? code_lover SQL Language 2 January 2nd, 2007 02:22 PM
Difference between Correlated Subquery and Subquer ramk_1978 SQL Language 2 June 12th, 2006 05:35 AM
Correlated Subquery Rewrite Needed gstanden SQL Language 5 November 24th, 2004 02:39 PM
Correlated Subquery part of Select List gstanden SQL Language 1 November 24th, 2004 07:25 AM
Mixing Data access logic and business logic polrtex BOOK: Professional Jakarta Struts 0 December 15th, 2003 07:19 PM



All times are GMT -4. The time now is 12:41 PM.


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