Welcome to WebmasterWorld Guest from 54.167.40.25

Forum Moderators: open

Message Too Old, No Replies

Skipping a row, whilst sorting a table

     
8:53 am on Jul 31, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 12, 2006
posts:2493
votes: 22


i'm guessing that this is probably impossible, but im hoping someone brainy knows how to do it...

i've got a page which displays a table of data, which is sorted by date. so far, so easy.

but when it comes to two rows in particular, i need them to appear as if they were the next row down. so when the script prints all the rows out, i need to skip over them for just one row, and print them after the next one.

is that possible?
4:28 pm on July 31, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Me gotz nuttin' . . . in mySQL anyway.

What are the "identifying factors" of these rows? Are they a series of conditions you can pick up via programmimg without hard coding them?
3:45 pm on Aug 2, 2010 (gmt 0)

Moderator from US 

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 10, 2005
posts:5551
votes: 24


Can you provide some example data? Will it always be those 2 rows, or rows meeting certain conditions?
5:19 pm on Aug 2, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 12, 2006
posts:2493
votes: 22


i think i've resigned myself to adding a new column.
but this is what the problem is...

it's a database of songs. and i can sort them alphabetically and by release date, because they're the only columns i've got.

when i sort them by release date, and two songs share the same date (because they are the A and B-side of a single) i naturally want to list the A-side first. but at the moment i can only list them alphabtically, which is wrong about 50% of the time.

so i was hoping i could get it to skip a row every time a certain song title came up.
5:41 pm on Aug 2, 2010 (gmt 0)

Moderator from US 

WebmasterWorld Administrator lifeinasia is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Dec 10, 2005
posts:5551
votes: 24


Yes, I would add another field and do a secondary ORDER on that field.
3:30 pm on Aug 14, 2010 (gmt 0)

Senior Member

WebmasterWorld Senior Member 5+ Year Member

joined:Apr 30, 2007
posts:1394
votes: 0


or you could expand the date col to be datetime and then set the secs for instance to force ordering without an additional col.
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members