Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help with date selection

Status
Not open for further replies.

TonCoronel

Programmer
Dec 1, 2003
37
NL
I need to retrieve a datawindow with a datecolumn. I only needs to get the rows from the last week. (multiple columns can have the same date) Not shure how to do this
 
If the number of rows retrieved regardless of date is not very many, I'd grab them all then apply a filter to look at only those within the last week.

If there are too many rows to retrieve, you need to apply the date restriction on the SQL statement with something like:

SELECT ....
FROM qxPart qp (nolock)
JOIN qxScheduleMaster sm (nolock) ON (qp.qxScheduleId = sm.qxScheduleId)
WHERE qp.partNo = '090000'
AND sm.effectiveDate IN (select sm.effectiveDate FROM qxPart qp (nolock)
JOIN qxScheduleMaster sm (nolock) ON (qp.qxScheduleId = sm.qxScheduleId)
WHERE qp.partNo = '090000'
AND getdate() >= sm.effectiveDate)

The sub-select is where you restrict the dates so your main select gets the rows you want.

(This is MS SQL Server syntax)
 
Tnx for the reply but I already solved it using an SQL query on the SQL server database it is running on

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top