Hi!
I am making inventory system online software.
in customerpayment table there are multi records for every customer. but i want to select last record for those customer who has arrear(Balance) like table below
its ok thanks for reply.
but my problem is not solved throug this matter because i want select multi records at one time query and should be display one by one even there will be thousend record.
ok do you understand my problem.
please response.
thanking you
Not really understanding because you said you wanted the 'last record'
So do you want the latest record for 1 user. Or do you want all records for 1 user? Or are you wanting the latest record for ALL users? can you be clearer?
yes i am doing it in php for webpage.
not against with a specifice date this should be display in a specific period like between 01-01-2010 and 20-01-2010.
i am using this query.
$data=mysql_query("select distinct(cpm.customerid),cpm.date,cpm.debet,cpm.credet,cpm.invoiceno,cpm.balance from customerpaymentsheet cpm where cpm.balance > '0' and cpm.date BETWEEN '$sdate' and '$edate' order by cpm.date DESC,cpm.customerid DESC");
but this is displaying multi records agains all user if they hava multi record in table.
shafiq2626 wrote:yes i am doing it in php for webpage.
not against with a specifice date this should be display in a specific period like between 01-01-2010 and 20-01-2010.
i am using this query.
$data=mysql_query("select distinct(cpm.customerid),cpm.date,cpm.debet,cpm.credet,cpm.invoiceno,cpm.balance from customerpaymentsheet cpm where cpm.balance > '0' and cpm.date BETWEEN '$sdate' and '$edate' order by cpm.date DESC,cpm.customerid DESC");
but this is displaying multi records agains all user if they hava multi record in table.
select DISTINCT cpm.customerid,cpm.date,cpm.debet,cpm.credet,cpm.invoiceno,cpm.balance from customerpaymentsheet cpm where cpm.balance > '0' and cpm.date BETWEEN '$sdate' and '$edate' group by cpm.customerid order by cpm.date DESC"
but this is displaying frist record against every user not last can you check please.