Re: Re: Getting Results

From: Date: Fri, 21 Jan 2011 12:39:47 +0000
Subject: Re: Re: Getting Results
References: 1 2 3 4  Groups: php.db 
Request: Send a blank email to php-db+get-47649@lists.php.net to get a copy of this message
Very informative, Thank you Richard. I will have to flag this one and come back to it. My database structure may require something of this measure down the line with the auditing ability I plan on building into the admin section. Never heard of USE AdventureWorks. Is that a SQL system function? Or just a table in the examples database? On Jan 21, 2011, at 6:16 AM, Richard Quadling wrote:
You also have (depending upon your SQL engine and version) something called common table expressions. (From MS SQL Books Online) ... USE AdventureWorks; GO WITH DirReps(ManagerID, DirectReports) AS (
    SELECT ManagerID, COUNT(*)
    FROM HumanResources.Employee AS e
    WHERE ManagerID IS NOT NULL
    GROUP BY ManagerID
) SELECT ManagerID, DirectReports FROM DirReps ORDER BY ManagerID; GO
Guess I will have to do some googling.. :) Thanks again. Best, Karl DeSaulniers Design Drumm http://designdrumm.com

« previous php.db (#47649) next »