Hi, I have 3 feilds in my invoice processing Table.
Now I am using this query
SELECT `SRNo` , `VenName` , `Submet` , TO_DAYS( NOW( ) ) - TO_DAYS( `Submet` ) AS Days FROM `invmain` WHERE `Status` = 'SENT TO PAYABLE' AND `Submet` != '0000-00-00' ORDER BY Days DESC
But this query give me result only on base of Submet.
But I need result on Resubmitted also when its resubmitted.
I need below mentioned Results...
if Submet date is 2011-03-22 this will show days pending 2.
But if Submet is 2011-03-10, but it will return and then resubmitted on 2011-03-20 then it give result 14 instead of 4 days
Edited by ayesha789: n/a