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.
| Author |
Topic |
|
l_schneider
Starting Member
4 Posts |
Posted - 2010-06-15 : 12:42:02
|
| I am writing a query that needs to have a start date. I do not know how to do this.My query needs to be of any local customers that have not order since "mm/dd/yyyy" |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-06-15 : 13:01:26
|
select *from customer cwhere not exists(select * from orders o where o.custId=c.custId and o.orderdate > 'yyyymmdd') No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
l_schneider
Starting Member
4 Posts |
Posted - 2010-06-15 : 13:20:03
|
| Sorry my first question wasn't very specific..Here's what I have so far..DECLARE @CALENDAR DateTimeSET @CALENDAR = '{{{Select Start Date}}}'SELECTtblCustomer.CustID as 'Customer ID',tblCustomer.LocalName as 'Local Name',tblCustomer.LocalContact as 'Local Contact',tblCustomer.LocalAddress as 'Local Address',tblCustomer.LocalCity as 'Local City',tblCustomer.LocalState as "Local State',tblCustomer.LocalZip as 'Local Zip'FROMtblCustomerINNER JOIN tblOrder ON tblCustomer.CustID = tblOrder.CustID(this is where I have the problem)WHEREtblOrder.OrderDate?????AND tblCustomer.BusinessID = 1AND tblCustomer.HouseAccount = 'FALSE'GROUP BYtblCustomer.CustID,tblCustomer.LocalName,tblCustomer.LocalContact,tblCustomer.LocalAddress,tblCustomer.LocalCitytblCustomer.LocalStatetblCustomer.LocalZipORDER BYtblCustomer.CustID,tblCustomer.LocalName,tblCustomer.LocalContact,tblCustomer.LocalAddress,tblCustomer.LocalCitytblCustomer.LocalStatetblCustomer.LocalZip |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-06-15 : 13:25:56
|
| [code]SELECTtblCustomer.CustID as 'Customer ID',tblCustomer.LocalName as 'Local Name',tblCustomer.LocalContact as 'Local Contact',tblCustomer.LocalAddress as 'Local Address',tblCustomer.LocalCity as 'Local City',tblCustomer.LocalState as 'Local State',tblCustomer.LocalZip as 'Local Zip'FROMtblCustomerLEFT JOIN tblOrder ON tblCustomer.CustID = tblOrder.CustID AND tblOrder.OrderDate > 'yyyymmdd'WHEREtblOrder.CustID IS NULLAND tblCustomer.BusinessID = 1AND tblCustomer.HouseAccount = 'FALSE'GROUP BYtblCustomer.CustID,tblCustomer.LocalName,tblCustomer.LocalContact,tblCustomer.LocalAddress,tblCustomer.LocalCitytblCustomer.LocalStatetblCustomer.LocalZipORDER BYtblCustomer.CustID,tblCustomer.LocalName,tblCustomer.LocalContact,tblCustomer.LocalAddress,tblCustomer.LocalCitytblCustomer.LocalStatetblCustomer.LocalZip[/code] |
 |
|
|
l_schneider
Starting Member
4 Posts |
Posted - 2010-06-15 : 13:32:23
|
| Thank you so so much. :) |
 |
|
|
vijayisonly
Master Smack Fu Yak Hacker
1836 Posts |
Posted - 2010-06-15 : 13:37:22
|
Np. You are welcome. |
 |
|
|
l_schneider
Starting Member
4 Posts |
Posted - 2010-06-15 : 13:39:23
|
| I'm sure I'll have more questions. I got handed a book yesterday and was told to make a query by end of day TODAY. I tried to learn quickly. Lol. :) |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|