Re: Simple Query Question
- From: "Plamen Ratchev" <Plamen@xxxxxxxxxxxxx>
- Date: Mon, 26 May 2008 16:54:28 -0400
What column in your tables has the date value when the enquiry was created? You need that date to be able to report those that were created in the last 30 days.
Assuming that column is named enquiry_date, your query may look like:
SELECT E.enquiryID,
E.introducerID,
E.enquiry,
E.enquiry_date,
I.networkName,
I.introducerName
FROM dbo.Enquiries AS E
JOIN dbo.Introducers AS I
ON E.introducerID = I.introducerID
WHERE I.networkName = 'Network Name'
AND E.enquiry_date >= DATEADD(DAY, DATEDIFF(DAY, 0, CURRENT_TIMESTAMP) - 30, 0);
HTH,
Plamen Ratchev
http://www.SQLStudio.com
.
- Follow-Ups:
- Re: Simple Query Question
- From: leebridgewater
- Re: Simple Query Question
- References:
- Simple Query Question
- From: leebridgewater
- Simple Query Question
- Prev by Date: Simple Query Question
- Next by Date: Re: Install new instance...
- Previous by thread: Simple Query Question
- Next by thread: Re: Simple Query Question
- Index(es):
Relevant Pages
|