Jump to content

Separating Items and Ordering Them


Yackem

Recommended Posts

Greetings. I own a message board and have recently added new Topic Types outside of the regular normal, stickies, global...etc.

 

Currently the sql looks as follows:

 

SELECT t.topic_type FROM phpbb_topics t WHERE t.forum_id = 2 AND t.topic_type IN (0,1,2,3,4,5,6,7,8,9) 
ORDER BY t.topic_type DESC, t.topic_last_post_time DESC 

 

The output shows

 

topic_type

9

9

9

8

8

8

.

.

.

 

I would like for the entries that have t.topic_type = 1 always be listed first and ordered by t.topic_last_post_time ASC. And then the remaining entries just ordered by t.topic_last_post_time DESC. So an output like this.

 

topic_type

1

1

1

1

1

1

4

5

3

.

.

 

Can anyone point me in the right direction as to get this accomplished? Thanks

Link to comment
https://forums.phpfreaks.com/topic/110007-separating-items-and-ordering-them/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.