Wrox Programmer Forums
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 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 November 16th, 2004, 03:21 PM
Registered User
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to razmar78
Default problem with query

Getting error with this query.. please help

SELECT ISNULL(solicitante_dir_ciudad,'DESCONOCIDO'),
COUNT(*) AS [Cantidad_de_Solicitantes],
COUNT(*) * 100.00 / (SELECT COUNT(*) FROM dat_datos_importados) AS [Por Ciento%] FROM dat_datos_importados
WHERE solicitante_dir_ciudad = CASE WHEN @Ciudad='TODOS' THEN solicitante_dir_ciudad ELSE @Ciudad END)
GROUP BY solicitante_dir_ciudad
ORDER BY solicitante_dir_ciudad



 
Old November 17th, 2004, 12:56 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

From where @Ciudad comes?

Om Prakash
 
Old November 17th, 2004, 06:16 AM
Friend of Wrox
 
Join Date: Sep 2004
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Anantsharma Send a message via Yahoo to Anantsharma
Default

HI,

Well i can see an extra closing paranthesis ")" just before END of case.

Please do mention the error statement also whenever u want others to look inside.

Gud luck

B. Anant
 
Old November 17th, 2004, 08:34 AM
Registered User
 
Join Date: Nov 2004
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to razmar78
Default

The value expression for the textbox ‘Ciudad’ refers to the field ‘Ciudad’. Report item expressions can only refer to fields within the current data set scope or, if inside an aggregate, the specified data set scope.

This is the query:

SELECT ISNULL(solicitante_dir_ciudad,'DESCONOCIDO'),
COUNT(*) AS [Cantidad_de_Solicitantes],
COUNT(*) * 100.00 / (SELECT COUNT(*) FROM dat_datos_importados) AS [Por Ciento%] FROM dat_datos_importados
WHERE solicitante_dir_ciudad = CASE WHEN @Ciudad='TODOS' THEN solicitante_dir_ciudad ELSE @Ciudad END
GROUP BY solicitante_dir_ciudad
ORDER BY solicitante_dir_ciudad




 
Old November 22nd, 2004, 08:05 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

cross-post at http://p2p.wrox.com/topic.asp?TOPIC_ID=22216

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Query Problem. rupen Access 3 April 27th, 2007 07:43 AM
Query Problem bundersuk VB Databases Basics 0 December 30th, 2006 07:50 AM
problem with query harpua Classic ASP Databases 1 January 24th, 2005 12:36 PM
Problem in query leo_vinay Classic ASP Databases 5 January 21st, 2005 06:32 AM
query problem mateenmohd SQL Server 2000 7 September 9th, 2003 11:58 PM





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