Ver Mensaje Individual
Antiguo 18-abr-2008, 03:20   #2 (permalink)
gianco321
gianco321 ha deshabilitado el karma
 
Avatar de gianco321
 
Fecha de Ingreso: abril-2008
Ubicación: Lima
Mensajes: 6
Enviar un mensaje por MSN a gianco321
Re: ¿¿¿select... if... from.... [where...]???

Hola el if hasta donde yo conozco no se puede en un Select pero lo puedes hacer de la siguiente form usando el Case, un ejemplo:

USE AdventureWorks;
GO
SELECT ProductNumber, Category =
CASE ProductLine
WHEN 'R' THEN 'Road'
WHEN 'M' THEN 'Mountain'
WHEN 'T' THEN 'Touring'
WHEN 'S' THEN 'Other sale items'
ELSE 'Not for sale'
END,
Name
FROM Production.Product
ORDER BY ProductNumber;
GO

Y se puede utilizar en MySQL, SQL Server, Posgress.

Espero haber resuelto tu duda lobo.
gianco321 está desconectado   Responder Citando