You are here: Is This Possible? « PHP SQL « IT news, forums, messages
Is This Possible?

Posted by Tyrone Slothrop on 04/03/07 05:23

I have a table which stores a member score on a monthly basis. I need
to run a query which finds those members who have seen the greatest
improvement and those who have shown the greatest loss from one month
to the next.

The fields:
member_id (integer)
score (double 3,1)
date (date)

I can find the greatest differences for the past two months with a
query like:

SELECT member_id, max(score) - min(score) as diff FROM monthly _report
WHERE MONTH(CURDATE())=MONTH(Date)-1 OR
MONTH[CURRDATE())=MONTH(Date)-2 GROOUP BY member_id;

However, as I said before, I need to find those which show the
greatest improvement and those who have shown the greatest loss
between the two months.

Is there are way of accomplishing this with a single query?

TIA!

 

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

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