Wrox Programmer Forums
|
BOOK: Professional SQL Server 2000 Programming
This is the forum to discuss the Wrox book Professional SQL Server 2000 Programming by Robert Vieira; ISBN: 9780764543791
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional SQL Server 2000 Programming 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 January 20th, 2007, 02:55 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to mitulkoradia
Default Problem With FIRST () Agregate function

hi

can any one help me to find the solution on my following problem

i am creating one Crostab query like done in ms Access. but there is one problem.

i have to use. FIRST() Aggregate function like SUM() AVG()

you can find help for that function from here..

http://www.w3schools.com/sql/sql_functions.asp

it says the FIRST Function is not supported in SQL Server 2000..

i want the same functionality as First() give. (First Row's Specified value of Group).

here i am giving you my sample query.

Code:
SELECT  qryRisk_Matrix.SystemName, qryRisk_Matrix.SAPFunctionalLocation, qryRisk_Matrix.SystemID, qryRisk_Matrix.BusinessName, 
                      qryRisk_Matrix.RegionName, qryRisk_Matrix.SchemeName, qryRisk_Matrix.CMSID, qryCapProjCount.CountOfProjectID, 
                      qrySwppProjCount.SwppProjCount,
                      'W-WQ' =FIRST(CASE RiskEventRef WHEN 'W-WQ' THEN qryRisk_Matrix.Risk0 END), 
                      'W-NH' = FIRST(CASE RiskEventRef WHEN 'W-NH' THEN qryRisk_Matrix.Risk0 END) FROM         qrySwppProjCount INNER JOIN
                      (qryCapProjCount INNER JOIN
                      qryRisk_Matrix ON qryCapProjCount.SystemID = qryRisk_Matrix.SystemID) ON qrySwppProjCount.SystemID = qryRisk_Matrix.SystemID
WHERE     (((qryRisk_Matrix.BusinessName) = 'Regulated Water'))
GROUP BY qryRisk_Matrix.SystemName, qryRisk_Matrix.SAPFunctionalLocation, qryRisk_Matrix.SystemID, qryRisk_Matrix.BusinessName, 
                      qryRisk_Matrix.RegionName, qryRisk_Matrix.SchemeName, qryRisk_Matrix.CMSID, qryCapProjCount.CountOfProjectID, 
                      qrySwppProjCount.SwppProjCount
Mitul N Koradia





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Round Function darrenb Access 3 May 22nd, 2007 05:45 PM
Date Function problem beetle_jaipur Classic ASP Basics 5 July 6th, 2006 01:08 PM
Problem with function mat41 Classic ASP Basics 3 July 16th, 2005 01:19 AM
shell function problem bml Excel VBA 1 February 12th, 2005 05:42 PM
Problem with a Javascript function SuMajestad PHP How-To 4 August 17th, 2004 09:04 PM





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