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 ???
sql
Moderator: General Moderators
-
prasadharischandra
- Forum Commoner
- Posts: 57
- Joined: Thu May 09, 2002 2:19 am
- Location: sri lanka
- Contact:
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
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
-
prasadharischandra
- Forum Commoner
- Posts: 57
- Joined: Thu May 09, 2002 2:19 am
- Location: sri lanka
- Contact: