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 ??
start a new thread probably this one's already more than 3 years old.
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
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 ??
It shouldn't. Can you post the table structure as well as some test data ?
It shouldn't. Can you post the table structure as well as some test data ?
i am right. :(
thank you for your help..
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
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.