Groups | Blog | Home
all groups > sql server new users > october 2006 >

sql server new users : how to query out sections?


_adrian
10/11/2006 12:38:13 PM
So I have a table with various records, each with different datetime fields
populated..I want to query the records and then display them on a web page
(ASP) so that when there's a different month, it breaks out as:

1/10/06
1/20/06
1/30/06
(note the space between each month)
2/10/06
2/20/06
2/30/06
....and so on
Help?

Arnie Rowland
10/11/2006 1:52:45 PM
It seems to me that this is really a question best answered by the client
application -NOT a SQL Server query.

--
Arnie Rowland, Ph.D.
Westwood Consulting, Inc

Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous


[quoted text, click to view]

Warren Brunk
10/11/2006 2:10:38 PM
This of course should be done inside your ASP code but to achieve this in
SQL you could always use a union operator.

Select datecolum from table where datepart(mm,datecolum) = 1
union
Select ''
union
Select datecolum from table where datepart(mm,datecolum) = 2
union
Select ''
union
Select datecolum from table where datepart(mm,datecolum) = 3
union
Select ''
union
Select datecolum from table where datepart(mm,datecolum) = 4

and so on and so on.

Not really the way to do it at all but if for some reason your skills lie on
the SQL Server Side instead of breaking out record sets in asp it might be
an option.

thanks,


--
/*
Warren Brunk - MCITP - SQL 2005, MCDBA
www.techintsolutions.com
*/


[quoted text, click to view]

_adrian
10/11/2006 4:25:43 PM
Thank you for your time gentlemen

AddThis Social Bookmark Button