SLQ Query - Use 2 WHERE Statements
-
Friday, January 18, 2013 9:04 AM
Hello,
The tables and fields needing to be used in the query are:
Table: CatReq Fields: Email, EntryDate
Table: TblCustomerAccounts Fields: Email, AccountID
Table: TblOrders Fields: AccountIDWhat I Need:
The query needs to display people who are located CatReq table who's EntryDate is after after '01/12/2012 00:00:00', and haven't placed and order will be displayed. This will be checked by the Email field being checked against the TblCustomersAccounts to get the AccountID and then this checked to see if the AccountID is within the order table.
I look forward to hearing a solution as it has royally got me stumped.
Thanks
Shaun Swales
Kind Regards, Shaun Swales Twitter: Https://www.twitter.com/CryptCommerce
All Replies
-
Friday, January 18, 2013 9:23 AM
You need to JOIN these tables, then you can apply an appropriate WHERE condition.
See
- Marked As Answer by Eileen ZhaoMicrosoft Contingent Staff, Moderator Thursday, January 24, 2013 1:55 AM
-
Friday, January 18, 2013 10:07 AM
Hi,
SELECT CatReq .Email FROM CatReq RIGHT JOIN TblCustomerAccounts ON CatReq.Email=TblCustomerAccounts.Email INNER JOIN TblOrders ON TblCustomerAccounts.AccountId=TblOrders.AccountId WHERE CatReq.EntryDate > '01/12/2012 00:00:00' AND CatReq .Email IS NULL
PS.Shakeer Hussain
- Marked As Answer by Eileen ZhaoMicrosoft Contingent Staff, Moderator Thursday, January 24, 2013 1:55 AM

