Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Generar informe
Message
 
 
To
12/04/2010 10:55:10
Luis Parada
Prosoft´s de Venezuela, C.A.
Valencia, Venezuela
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Environment versions
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01459766
Message ID:
01459767
Views:
60
>He realizado este SELECT en SQL-SERVER 2005 y me funciona perfecto, el problema está cuando quiero llevar dicho SELECT a un formulario de consultas en Visual Foxpro 9.0
>
>Ejemplo:
>select fecha_des,case when horario=1 THEN 'AM' ELSE 'PM' END AS HORARIO,
SUM(case when cod_lin='L01' THEN min_prod ELSE 0.00 END) AS MP1,
SUM(case when cod_lin='L01' THEN min_espe ELSE 0.00 END) AS ME1,
SUM(case when cod_lin='L01' THEN min_ocio ELSE 0.00 END) AS Mo1,
>SUM(case when cod_lin='L02' THEN min_prod ELSE 0.00 END) AS MP2,
SUM(case when cod_lin='L02' THEN min_espe ELSE 0.00 END) AS ME2,
SUM(case when cod_lin='L02' THEN min_ocio ELSE 0.00 END) AS Mo2,	
>SUM(case when cod_lin='L03' THEN min_prod ELSE 0.00 END) AS MP3,
SUM(case when cod_lin='L03' THEN min_espe ELSE 0.00 END) AS ME3,
SUM(case when cod_lin='L03' THEN min_ocio ELSE 0.00 END) AS Mo3
 from encnotdes GROUP BY fecha_des,horario ORDER BY fecha_des,horario
>
>
>¿Como Lo realizaria en Visual Foxpro 9.0?
>
>Muchas Gracias de Antemano.

Luis,

Try
select fecha_des,ICASE( horario=1, 'AM', 'PM')  AS HORARIO,SUM(IIF(cod_lin='L01',min_prod, 0.00)) AS MP1,
SUM(IIF(cod_lin='L01',min_espe,0.00))  AS ME1,

etc. for other sums

from encnotdes GROUP BY fecha_des,horario ORDER BY fecha_des,2
CASE function in SQL Server translates into IIF or ICASE function in VFP.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform