Current location: Hot Scripts Forums » Programming Languages » ASP » Sql Query Help - ASP


Sql Query Help - ASP

Reply
  #1 (permalink)  
Old 11-07-06, 12:02 AM
cancer10 cancer10 is offline
Wannabe Coder
 
Join Date: Oct 2006
Location: India
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
Question Sql Query Help - ASP

Hello,
I am developing a simple calender in ASP which will display the next upcoming birthday of my member. Just like some forum have.

I have a table which has 2 column

cname | dob
-------------------
Joe | 9/12/1982
Mathew | 2/17/1997
Pat | 8/23/1880

-------------------
What SQL Query should I use to get the name of that person?

Some basic information:

Database = Access (may be I can upgrade it into SQL Server 2000)

Date Format in database = mm/dd/yyyy
Reply With Quote
  #2 (permalink)  
Old 11-07-06, 02:24 PM
koncept
Guest
 
Posts: n/a
select cname from <tablename>

but you will need to do some other work with that query to make it work for you application
Reply With Quote
  #3 (permalink)  
Old 11-07-06, 10:11 PM
cancer10 cancer10 is offline
Wannabe Coder
 
Join Date: Oct 2006
Location: India
Posts: 154
Thanks: 0
Thanked 0 Times in 0 Posts
other work Like?
Reply With Quote
  #4 (permalink)  
Old 11-08-06, 06:07 AM
koncept
Guest
 
Posts: n/a
setting it up to limit it to the current month if in a calendar type view. or if you are querying for each day that is rendered a statement to limit it to that day of that month
Reply With Quote
  #5 (permalink)  
Old 05-06-10, 06:12 PM
dan.orbit dan.orbit is offline
Newbie Coder
 
Join Date: May 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Couple query ideas

Not quite sure exactly what you're looking for, but...

For displaying people celebrating their birthday today (with their age):
PHP Code:

SELECT cname,dob,YEAR(NOW())-YEAR(dob) AS age FROM <tableWHERE DAYOFYEAR(dob) = DAYOFYEAR(NOW());

// Returns 28 as `age` when the current date is 2010-09-12 
Simply display the next birthday of an individual person:
PHP Code:

SELECT MAKEDATE(YEAR(NOW()), DAYOFYEAR(dob)) AS next_bday FROM <tableWHERE cname='<name>';

// Returns 2010-09-12 as `next_bday` for a dob of 9/12/1982 
Cheers
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP ADO SQL Query TheShadow ASP 1 05-26-05 07:08 AM
How to do SQL query in a ASP while loop superman2004 ASP 2 09-09-04 03:35 AM
Declared Functions skipper23 PHP 4 12-17-03 10:06 AM
index page not showing up skipper23 PHP 3 12-15-03 01:10 PM
change my field in this example sal21 ASP 3 07-14-03 02:49 AM


All times are GMT -5. The time now is 03:53 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.