This will get the last 30 records in the DB. This will only work the way you want it
if there is one record going in per day every day. Otherwise, you'll just be getting
the last 30. If you want to be sure on the dates, you'll have to query on a date field
of some sort with a datediff() function in SQL.
where datediff('d', now(), datefield) LT 30
will get you all the records that are within 30 days of the current day.
>Hi,
>
>I am trying to help someone with a SQL query and was wondering if
>someone here could help me with my reasoning. The goal is to get all
>records entered within the last 30 days that meet one specific
>criterion. Would something like this work?
>
>
>SELECT Top 30 *
>FROM myTable
>WHERE someCol = 'value'
>ORDER BY someCol DESC
>
>Best regards,
>Michael Wilson <mailto:[EMAIL PROTECTED]> - IQMax
><http://www.iqmax.com/> - Software Engineer
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=6
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=6
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm