Page 1 of 1
sql
Posted: Thu May 16, 2002 4:02 am
by prasadharischandra
i want to sort a two filed using order by
this is a code
where codeid='$codeid' order by member='Y',rank DESC;
if any know what is wrong ???
Posted: Thu May 16, 2002 4:12 am
by mikeq
I'm pretty sure you can't put the member='Y' in the order by clause, you can have order by member, rank DESC;
You will need to limit to 'Y' in the where clause
where codeid='$codeid' and member='Y' order by rank DESC;
What are you really trying to acheive? Do you just want to output members and sort by rank, or do you want to output all users but have members appear first in your listing?
If it the second case and assuming members has 2 values 'Y' or 'N' then
where codeid='$codeid' order by member, rank DESC; will work
Posted: Thu May 16, 2002 4:55 am
by prasadharischandra
i want to show the top of the row .
if members yes and rank is high and if perosn doesn't have a member
he goes to down
thank u
Posted: Fri May 17, 2002 2:27 pm
by JoeMN
You can't put the = in the order. Try this:
order by member desc, rank desc
This is assuming that the only values of member are Y and N.