You are here: I need help on a query « PHP SQL « IT news, forums, messages
I need help on a query

Posted by Alex.HANIN on 09/25/06 11:04

Hi,

I have a table structured as follow:
id | user_id | credit
---+---------+-----------
1 | 1 | 5
2 | 1 | -5
3 | 2 | 10
4 | 1 | -7
5 | 2 | 6
6 | 2 | -3
7 | 3 | 9

I need to be able to get the user_id where the last amount entered is
negative (<0)
In that example, I would want to get the user_id 1 and 2

id is auto-incremental

I cannot use sub-select as mysql version is < 4.1 and I would prefer to
have it all in one query as there is more processing after...

Help, it is driving me crazy

Thanks for the help

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация