|
|
|
||||
|
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() |
|
|||||||
| Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
|
Thread Tools |
|
|
#1 |
|
Registered User
Join Date: Jun 2003
Posts: 51
|
Mysql ORDER BY Help needed
I need to know how to order mysql queries so that they are first ordered by Rating, then when Rating = 1, order by Hits_Sent.
Is that at all possible? |
|
|
|
|
|
#2 |
|
Confirmed User
Join Date: Feb 2003
Location: Sacramento
Posts: 1,751
|
select * from table where rating = "1" order by Hits_Sent
Why would you want to order by rating first, if you are only going to return where rating equals 1? Maybe you need to explain more on what you are looking to do.
__________________
Selfpleasure.com for sale on auction. Closes on Tuesday March 11th at 9pm PST!!!! Dirty enough to be good, but clean enough for everyone! ------------------------------------------------------------------ ![]() Moral Police - First graduating class coming soon! - Forcing our values across the internet |
|
|
|
|
|
#3 |
|
Confirmed User
Join Date: Feb 2003
Location: Sacramento
Posts: 1,751
|
ICQ me if you want to.
__________________
Selfpleasure.com for sale on auction. Closes on Tuesday March 11th at 9pm PST!!!! Dirty enough to be good, but clean enough for everyone! ------------------------------------------------------------------ ![]() Moral Police - First graduating class coming soon! - Forcing our values across the internet |
|
|
|
|
|
#4 |
|
Registered User
Join Date: Jun 2003
Posts: 51
|
Rating can be anywhere from 1 to 10.
For every result that has a Rating over 1, I want them to be ordered by Rating. The rest are Rating='1' and they have to be ordered by Hits_Sent. |
|
|
|
|
|
#5 | |
|
Confirmed User
Join Date: Feb 2003
Location: Sacramento
Posts: 1,751
|
Quote:
Or start at 2 and work up to 10...and then return rating = 1?
__________________
Selfpleasure.com for sale on auction. Closes on Tuesday March 11th at 9pm PST!!!! Dirty enough to be good, but clean enough for everyone! ------------------------------------------------------------------ ![]() Moral Police - First graduating class coming soon! - Forcing our values across the internet |
|
|
|
|
|
|
#6 |
|
Damn Right I Kiss Ass!
Industry Role:
Join Date: Dec 2003
Location: Cowtown, USA
Posts: 32,421
|
He wants the equivelent of this:
Select info and order it by rating first 10 to 1 and then if those have matches, order it by hits sent higher before lower. So rating 6 hits sent 10 comes before rating 6 hits send 5. |
|
|
|
|
|
#7 |
|
Mainstream since 2010
Industry Role:
Join Date: Jan 2003
Posts: 1,327
|
Have you tried
SELECT * FROM table GROUP BY rating ASC ORDER BY Hits_Sent DESC
__________________
Alea iacta est |
|
|
|
|
|
#8 |
|
Confirmed User
Join Date: Dec 2002
Location: Tampa
Posts: 355
|
SELECT * FROM TABLE
ORDER Ratings DESC, Hits_Sent This will first order it by Ratings Descending 10 to 1 and then within those ratings it will order it by Hits_Sent
__________________
SIG TOO BIG! Maximum 120x60 button and no more than 3 text lines of DEFAULT SIZE and COLOR. Unless your sig is for a GFY top banner sponsor, then you may use a 624x80 instead of a 120x60. |
|
|
|
|
|
#9 |
|
see you later, I'm gone
Industry Role:
Join Date: Oct 2002
Posts: 14,122
|
select rating, if(rating=1,hits_sent,0) as hits_sent from table order by rating asc, hits_sent desc
__________________
All cookies cleared! |
|
|
|
|
|
#10 |
|
Confirmed User
Join Date: Nov 2003
Location: Ontario, CA
Posts: 146
|
I dont mind helping out with a random question here and there, but perhaps you would be better off asking programming and database questions at a different forum.
They are, after all, non-porn-specific and you might get more help there. Just a suggestion. ![]() |
|
|
|