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
 General SQL Server Forums
 New to SQL Server Programming
 Date Query

Author  Topic 

clamjowster
Starting Member

1 Post

Posted - 2005-12-19 : 08:06:15
Hello, this is my first time with SQL.
I have a Mysql database of 3 tables
1)CUSTOMER (cust#, name, address, tel#, etc)
2)PRODUCT (prod#, desc, price, etc)
3)BOOKINGS (cust#, prod#, order_date)

I also have an admin page with options to display:
1)all bookings
2)bookings for next 7 days
3)bookings for next 14 days

How do I query the database to show the cust#, prod# and order_date from the BOOKINGS table, and the name, address, price from the CUSTOMER table for the three date options above?
I think I need to join two tables within a SELECT statement but am stuck on how to use todays date in the query.
Many thanks
Clam

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2005-12-19 : 08:12:04
This forum is for MS SQL, try www.mysql.org or www.dbforums.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-12-19 : 08:15:25
>>I have a Mysql database of 3 tables

This is SQL Server Forum. Post your question at MySQL forum for better responses

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Frank Kalis
Constraint Violating Yak Guru

413 Posts

Posted - 2005-12-19 : 08:31:36
Check http://www.mysql.com for DATE_ADD().
Something like

WHERE < your_column > BETWEEN < Now > AND DATE_ADD(< Now >, INTERVAL 7 DAY)


--
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt? http://www.insidesql.de/blogs
Go to Top of Page
   

- Advertisement -