Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List a week

Status
Not open for further replies.

dimsis

Programmer
Aug 6, 2000
76
0
0
GR
I have a table ( LINKS ) with fields:
LINKTITLE, LINKDATE, LINKURL
where LINKTITLE is nvarchar with links Titles, LINKDATE is a datetime with the date the record inserted into the table and LINKURL is an nvarchar with the site URL.

What i need is a select query that groups and returns the records for a given time period OR the current week as the following example:

Sunday 19/12/2004
14:20 - Link Title 78
14:20 - Link Title 34

Monday 20/12/2004
22:20 - Link Title 8

Tuesday 21/12/2004
14:20 - Link Title 44
17:20 - Link Title 45

Wednesday 22/12/2004
20:20 - Link Title 11

Thursday 23/12/2004
4:20 - Link Title 49
5:40 - Link Title 32
10:33 - Link Title 84

Friday 24/12/2004
14:20 - Link Title 19
18:40 - Link Title 82
20:33 - Link Title 24

Saturday 25/12/2004
12:20 - Link Title 1
13:40 - Link Title 8
15:33 - Link Title 14
16:22 - Link Title 19

Any (simple) suggestions?
 
Make simply:
Code:
SELECT LINKTITLE, LINKDATE, LINKURL
FROM LINKS
WHERE <filter_condition_here>
ORDER BY LINKDATE
... then process records outside database. Here is general logic (kinda VB/ASP-like):
Code:
Do While not RS.Eof
	lastDate = DateValue(RS("LINKDATE").value)
	print( lastDate )
	
	Do While not RS.Eof
		If lastDate <> DateValue(RS("LINKDATE").value) Then Exit Do
		print ( time, title, url )
	
		RS.moveNext
	Loop
	
	print ( empty row )
Loop
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top