a webmaster learning community
     Home    Register     Search      Help      Login    
FrontPage Alternative
Sponsors

Hosting from $3.99 per month!

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions. dd

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

 

SQL Select Statement - Day of Week

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> SQL Select Statement - Day of Week
Page: [1]
 
achappell

 

Posts: 12
Joined: 8/16/2005
Status: offline

 
SQL Select Statement - Day of Week - 2/6/2007 11:37:56   
I am trying to find a way to select a record based on the current day of the week. I have a table with 7 records in it, one for each day of the week. It looks similar to this:

ID Day_Week Message
1 Monday The special for Monday is...
2 Tuesday The special for Tuesday is...
3 Wednesday The special for Wednesday is...
4 Thursday The special for Thursday is...
5 Friday The special for Friday is...
6 Saturday The special for Friday is...
7 Sunday The special for Sunday is...

How would I build my Select statement to, for example, select the Monday record if the current day was Monday?
ou812

 

Posts: 1612
Joined: 1/5/2002
From: San Diego
Status: offline

 
RE: SQL Select Statement - Day of Week - 2/6/2007 11:51:06   
If you're using ASP you can use the weekday(date()) to obtain the numbered day of week, then you can select which one.

Something like:

dayofweek = weekday(date())
select Message from table where ID = dayofweek

_____________________________

-brian

EnterpriseDB: Enterprise-class relational database management system
PostgreSQL: The world's most advanced open source database

(in reply to achappell)
achappell

 

Posts: 12
Joined: 8/16/2005
Status: offline

 
RE: SQL Select Statement - Day of Week - 2/6/2007 18:11:04   
Thanks that worked great!

quote:

weekday(date())

(in reply to achappell)
Page:   [1]
OutFront Discoveries

All Forums >> Web Development >> ASP and Database >> SQL Select Statement - Day of Week
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts