On 24-Mar-2004 Henrik Schröder wrote:
snip
No, I did not choose the sort order. No, I can not change the values
used.
Yes, it has to be this sort order. :-)
Best would be to use ENUM( '1','2','0') ...
But otherwise --
(membershiptype % 2) DESC, membershiptype DESC
-- or --
Hi all,
I have a table of users which contains a lot of information, and also a
column called membershiptype which can either be 0, 1, or 2. This table is
used a lot in various searches, and all results should be ordered by
membership type, but the order should not be 0-1-2, but instead 1-2-0.
Does the where clause contain the order by columns? If not, then you will have
a filesort no matter what.
On Wed, 24 Mar 2004, Henrik Schröder wrote:
Hi all,
I have a table of users which contains a lot of information, and also a
column called membershiptype which can either be 0, 1, or 2.
From: Henrik Schröder [EMAIL PROTECTED]
used a lot in various searches, and all results should be ordered by
membership type, but the order should not be 0-1-2, but instead 1-2-0.
One thing you could do (not very neat IMHO) is to JOIN this query with a
table that contains membershiptype and a
Let me rephrase my statement. Does the index being used include the order by
columns? If not, the optimizer will not be able to perform both row selection
and row ordering in the same pass.
On Wed, 24 Mar 2004, Victor Pendleton wrote:
Does the where clause contain the order by columns? If not,
On Wed, 24 Mar 2004 15:47:46 +0100, Henrik Schröder wrote:
I have a table of users which contains a lot of information, and
also a column called membershiptype which can either be 0, 1, or 2.
This table is used a lot in various searches, and all results
should be ordered by membership type,
-
From: Victor Pendleton [mailto:[EMAIL PROTECTED]
Sent: den 24 mars 2004 16:22
To: [EMAIL PROTECTED]; Henrik Schröder; '[EMAIL PROTECTED]'
Subject: Re: How to optimize ugly order by?
Let me rephrase my statement. Does the index being used include the order by
columns? If not, the optimizer
Hemert [mailto:[EMAIL PROTECTED]
Sent: den 24 mars 2004 16:12
To: [EMAIL PROTECTED]
Subject: Re: How to optimize ugly order by?
From: Henrik Schröder [EMAIL PROTECTED]
used a lot in various searches, and all results should be ordered by
membership type, but the order should not be 0-1-2
the biggest problem, right?
/Henrik
-Original Message-
From: Victor Pendleton [mailto:[EMAIL PROTECTED]
Sent: den 24 mars 2004 16:22
To: [EMAIL PROTECTED]; Henrik Schröder; '[EMAIL PROTECTED]'
Subject: Re: How to optimize ugly order by?
Let me rephrase my statement. Does
I assume you are just trying to make things more readable. As far as I
know, MySQL does not support custom sort orders, except when a field is
an enum or a set. Even then, that's not a custom order since your still
sorting on the underlying values.
You could do something like this for
Henrik Schröder wrote:
Hi all,
I have a table of users which contains a lot of information, and also a
column called membershiptype which can either be 0, 1, or 2. This table is
used a lot in various searches, and all results should be ordered by
membership type, but the order should not be
Can you do:
SELECT
IF(membershiptype = 0, 3, membershiptype) AS s1
FROM...
ORDER BY s1
Shouldn't that work? Basically if mtype is 0 return 3 otherwise return
the membership type... and sort by that field.
lemme know if that works or if I'm dead wrong ;)
Henrik Schröder wrote:
Hi all,
12 matches
Mail list logo