Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 do loop in query

Author  Topic 

pablito
Starting Member

2 Posts

Posted - 2008-05-02 : 17:16:45

hi,

I have this query, with this I get 60 individuals reports...

SELECT     cedula, UPPER(nombres) AS Nombre, UPPER(sala) AS Sala, turno, fechaactividad
FROM clinicas
WHERE (fechaactividad = @fechaactividad) AND (turno = @turno) AND (sala = @sala)
GROUP BY cedula, nombres, sala, turno, fechaactividad
ORDER BY NEWID()


I want to write a query but using a group by sentence and using this parameters:

fechaactividad: Datetime.Now (but are five days per week, date initial, date final)
turno: AM/PM
sala = this are 6 rooms

the first report:
fechaactividad = actual date, turno = AM sala = one.
the second report:
fechaactividad = actual date, turno = PM sala = one.

the third report:
fechaactividad = actual date, turno = AM sala = two.
fechaactividad = actual date, turno = PM sala = one.

this function NEWID() is used to randomize the users.

and so...

anyone can give me some tips or a example query that I can adapted to my request?

I dont have idea in how do I its.

I want to build a one click report, this is for a very old woman with very bad computer experience... :(

Thanks,

Pablito

pablito
Starting Member

2 Posts

Posted - 2008-05-02 : 17:32:21
sorry other things.

I want to set the date, and the @turno and @sala are constants

turno is = AM/PM
sala is = uno, dos, tres, cuatro, cinco, seis.

the first report is April,21 2008 AM, sala uno
the second report is April,21 2008 PM, sala uno
the third report is April,21 2008 AM, sala dos
the 4 report is April,21 2008 PM, sala dos

later

second date

the first report is April,22 2008 AM, sala uno
the second report is April,22 2008 PM, sala uno
the third report is April,22 2008 AM, sala dos
the 4 report is April,22 2008 PM, sala dos

this is I mean.
Go to Top of Page
   

- Advertisement -