June 7, 2009 at 8:08 pm
Hi
i have the following query:
SELECT E.IDEmisionSeriada,
YEAR(S.FechaPrestamo) AS [Año],
COUNT(*) AS Seriadas, @FechaIni as FechaInicial, @FechaFin as FEchaFinal, @Tipo as Material
from dbo.Servicios S, Ejemplares E, EmisionesSeriadas ES
where S.CodigoAcceso = E.CodigoAcceso
and E.IDEmisionSeriada = ES.IDEmisionSeriada
and S.FechaPrestamo IS NOT NULL
and S.FechaPrestamo between @FechaIni and @FechaFin
GROUP BY E.IDEmisionSeriada,
YEAR(S.FechaPrestamo)
In this query i group by Year, but i need to group whit semester, how can i do this?
thank you any help
June 7, 2009 at 9:17 pm
EIAnd (6/7/2009)
In this query i group by Year, but i need to group whit semester, how can i do this?
Hi,
A bit question,
In your statement which one is the semester column?
and or how many semester is one year?
ARUN SAS
June 7, 2009 at 9:29 pm
hi,
a year have 2 semesters.
i dont have a column name semester, i need to change the year for semester.
thank you for your help 🙂
June 7, 2009 at 10:16 pm
Hi,
Try this,
SELECT E.IDEmisionSeriada,
YEAR(S.FechaPrestamo) AS [Año],
-- START
(case when MONTH(S.FechaPrestamo) <=6 then 'First Seme' else 'Second Seme' end)Semester
-- END
COUNT(*) AS Seriadas,
@FechaIni as FechaInicial,
@FechaFin as FEchaFinal,
@Tipo as Material
from dbo.Servicios S,
Ejemplares E,
EmisionesSeriadas ES
where S.CodigoAcceso = E.CodigoAcceso
and E.IDEmisionSeriada = ES.IDEmisionSeriada
and S.FechaPrestamo IS NOT NULL
and S.FechaPrestamo between @FechaIni and @FechaFin
GROUP BY
E.IDEmisionSeriada,
YEAR(S.FechaPrestamo),
--start
(case when MONTH(S.FechaPrestamo) <=6 then 'First Seme' else 'Second Seme' end)
--END
ARUN SAS
June 8, 2009 at 7:09 pm
thank very mutch Arun Sas works pretty good.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply