
July 13th, 2012, 06:56 AM
|
|
Registered User
|
|
Join Date: Oct 2011
Posts: 9
Time spent in forums: 1 h 43 m 28 sec
Reputation Power: 0
|
|
|
Return records from table based on current_date
Hello,
Consider this table
agent_id | mu_id | agent_data_id | c_sdate | c_edate | agent_data_value
----------+-------+---------------+------------+------------+------------------
1 | 1 | 1 | 2011-11-20 | 2012-01-05 | Doc Martin
1 | 1 | 1 | 2012-01-06 | 2012-09-02 | Neil Morrisey
1 | 1 | 1 | 2012-09-03 | | David Evans
1 | 1 | 5 | 2012-03-22 | | 1234567890
This table contains a start and end date so I need a query that says return rows if the current date is between those dates, for example if the current date is the 2012-07-13 then it should return the row with value Neil Morrisey. Also it is important to note that this table could only contain one row with no end date so the query should return that if the above is not true.
Hopefully that make some sense!
|