Mysql query needed for problem

Prof.Merlin

Expert Member
Joined
Aug 2, 2006
Messages
1,695
Reaction score
201
Location
Netherlands
Hi

Basically what I need is a query that returns the month. If the query is fun before the 26th of June, it should report back the last date was 26 of May. If it was done after the 26th of June, it should return back the 26th of June.

So it should always report back the last months 26th day.

Hope that makes sense :/

Tx!
 
CREATE DEFINER=`root`@`%` PROCEDURE `GetFinancialDate`()
BEGIN
if Day(NOW())>25 then
select NOW();
else
select DATE_SUB(NOW(), INTERVAL 1 MONTH);
end if;
END

call GetFinancialDate();
 
using @udiS3 logic but without the need for a storedproc ...

select if (Day(NOW())>25,NOW(),DATE_SUB(NOW(), INTERVAL 1 MONTH)) as test;
 
Top
Sign up to the MyBroadband newsletter
X