TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Show data from the last status = R (http://www.talkphp.com/general/5161-show-data-last-status-r.html)

russellharrower 12-11-2009 10:27 AM

Show data from the last status = R
 
Hi I was wondering if anyone can help me, I need to be able to get information from my MYSQL database but only show the data that was added since the last status = R

for e.g.

Amount | Status
0.00 | R
1.90 | 0
1.40 | 0
0.00 | R
0.50 | 0

What I want it to show is 0.50

adamdecaf 12-11-2009 11:08 PM

Unless you have assigned each row an ID it will take pulling the whole db and then only using the last row. At least I think that's how you do it, there may be a MySQL command that I don't know about.

russellharrower 12-14-2009 04:33 AM

Yes each row has an id which is auto assigned.

delayedinsanity 12-14-2009 06:50 PM

mysql Code:
SELECT amount, status FROM table WHERE id >= ( SELECT id FROM table WHERE status = 'R' ORDER BY id DESC LIMIT 1 )

Something to that effect should help you get started.


All times are GMT. The time now is 06:54 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0