Reply
Old 02-08-2007, 03:07 PM Order By
Skilled Talker

Posts: 56
Name: Jose daSilva
Hi

I do need to every time that I promote a specific iproduct from a list of many products into another list I do need the last promoted stays into the top of that list.
ID DESC or ID ASc will order them by ID.

I just want that the last to be at the top

thanks

JS
josil is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 02-08-2007, 03:41 PM Re: Order By
rogem002's Avatar
Webmaster Talker

Posts: 665
Name: Mike
Location: United Kingdom
What do you mean? :P Below is what i think you mean.

If you want them ordered by an ID do the following

"SELECT `tablename` ORDER BY ID ASC LIMIT 0,15"

Let me break is down and explain it all

"SELECT `tablename`" - Selects the table.
"ORDER BY ID" - Tells MySQL to order by the ID.
"ASC" - Makes the information Ascend.
"LIMIT 0,15" -Limits to 15 ID's, starting from 0.
__________________
PHP Code:
Add_Talkupation('rogem002'); // Because sharing is awesome! 
Fix 90% of your internet problems

Last edited by rogem002 : 02-08-2007 at 03:43 PM. Reason: More needed.
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 02-08-2007, 04:03 PM Re: Order By
Learning Newbie's Avatar
Moderator

Latest Blog Post:
Astounding Republican Paranoia
Posts: 5,678
Name: John Alexander
If you want most recent sort by date descending.
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 02-09-2007, 09:24 AM Re: Order By
Skilled Talker

Posts: 56
Name: Jose daSilva
ok people

Probably I do not explain right. What do I need is to chose the one that must be at the top
If I use DESC the the highest reference it will be at the top. But sometimes the one that I want to be at the top is one product that has a in bettwen references
for instance if I have 5 products from 1 to 5 I want that some times for promotions the number 4 or next day the number 3. those are the ones that I want to appear at the top.
Desc will give me from 5 to 1 and ASc fron 1 to 5.
i hope that I explain properly now
thanks
josil is offline
Reply With Quote
View Public Profile
 
Old 02-09-2007, 01:23 PM Re: Order By
bbutton's Avatar
Experienced Talker

Posts: 43
Name: Bill Button
Location: Reading,UK
Hi,

This would depend on the table structure, but if you for example have a bit field for active promotion you could then for example.

Order by ActivePromotion, ID Desc

This would list all the active promotions at the top ordered by id and then all the following promotions also ordered by id.

If you do not have an existing field you will have to create something that can be used to order by.
bbutton is offline
Reply With Quote
View Public Profile Visit bbutton's homepage!
 
Reply     « Reply to Order By
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.13078 seconds with 12 queries