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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 09-25-2004, 11:43 AM   #1
archael
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?
archael is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 11:47 AM   #2
malakajoe
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
malakajoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 11:48 AM   #3
malakajoe
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
malakajoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 11:55 AM   #4
archael
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.
archael is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 11:57 AM   #5
malakajoe
Confirmed User
 
Join Date: Feb 2003
Location: Sacramento
Posts: 1,751
Quote:
Originally posted by archael
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.
So do you want rating = 10 to be returned first, then 9, etc..?

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
malakajoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 12:10 PM   #6
V_RocKs
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.
V_RocKs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 12:29 PM   #7
milambur
Mainstream since 2010
 
milambur's Avatar
 
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
milambur is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 12:38 PM   #8
Imageauction
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.
Imageauction is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 12:48 PM   #9
sarettah
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!
sarettah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 09-25-2004, 01:09 PM   #10
TDJ
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.
TDJ is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.