selecting last inserted row in mysql and other conditions

im having the table name fiscalyear

These are the columns

  • id(auto increment)
  • begin (financial year begin date)
  • end (financial year end date)
  • active (either 0(open) or 1(closed))

  • begin column consists dates like 2012-01-01

  • end column consists dates like 2012-12-31

i want to get the financial year begin and end date

These are the conditions

  1. which is open i.e 0,
  2. also it should be the last inserted.

Here is the query i tried please update my query according to my conditions

SELECT BEGIN,END FROM fiscalyear WHERE active='0'


  1. I want to print the selected dates in format 2012-13 on the screen using PHP

Leave a Reply


Hire Me
Follow Me!
Most Popular Articles & Pages
Because your vote is Important
Sorry, there are no polls available at the moment.