Gracias nuevamente Teri
, mira.. ya probé la query.. pero me está marcando un error el siguiente error
Cita: Invalid length parameter passed to the substring function.
y tengo la siguiente query:
Código PHP:
SELECT Category, Count(Category) as Total, (Select CASE Left(category, CharIndex(' ', category))
WHEN 'Bir' THEN 'Otros'
WHEN 'Datos' THEN 'Otros'
ELSE Left(category, CharIndex(' ', Category) -1)
END
AS category from reportcomplete
where client_name like '%renault.%') AS Sub_Q_1
from reportcomplete
where date_created > convert(datetime,'01/01/2003',103)
and date_created < convert(datetime,'01/02/2003',103)
group by category
Por cierto.. me imagino que va un
, despues de:
SELECT Category, Count(Category) as Total
, (Select CASE Left(category, CharIndex(' ', category))
verdad.??
Y otra cosa, ésta consulta me va a devolver tres columnnas..?? o como esá funcionando exactamente la subquery..??
Gracias