0

i have a code like this

select * from tableX group by fieldA order by fieldB

this code sort according to fieldA. but i need to sort according to fieldB.

please help me ??

4
Contributors
6
Replies
7
Views
8 Years
Discussion Span
Last Post by almostbob
0

i have a code like this

select * from tableX group by fieldA order by fieldB

this code sort according to fieldA. but i need to sort according to fieldB.

please help me ??

You should have started a new thread. But anyway, Your query is fine and it should sort on fieldB. Try using ASC or DESC with the query to double check. :)
ie.,

select * from tableX group by fieldA order by fieldB ASC
0

my original code is:

SELECT id_topic, subject 
	FROM smf_messages WHERE  id_board=$bolum 
	GROUP BY id_topic 
	ORDER BY id_msg DESC

it still sort according to GROUP BY.

what are your opunions ??

0

once the id topics are grouped the individual id_msgs may not be available for sort
perhaps what you want is

SELECT id_topic, subject FROM smf_messages WHERE  id_board=$bolum ORDER BY id_topic, id_msg DESC
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.