FeedForAll Forum Index  
 Home  •  FAQ  •   Search   •  Register   •  Profile   •  Log in
 Problem in mysql when ordering by more than one column usin View next topic
View previous topic
Post new topicReply to topic
Author Message
johndavid



Joined: 03 Aug 2009
Posts: 1

PostPosted: Tue Aug 04, 2009 3:42 am Reply with quoteBack to top

Hi,

I have a MySQL query where I sort by field like this:

"... WHERE (patterns.id IN($idsJoin)) $where
ORDER BY FIELD($idsJoin2) LIMIT 0 , $numLines";

where $idsJoin2 is something like this:

my $idsJoin = join(',',@ids);
my $idsJoin2="patterns.id, ".$idsJoin;

and "@ids is an array with numbers I want to order by.

The thing is that after ordering by $idsJoin2, I want to order by another columns, like this:

"WHERE (patterns.id IN($idsJoin)) $where
ORDER BY FIELD($idsJoin2), products.product, versions.version, builds.build LIMIT 0 , $numLines";

If I put that columns before ORDER BY FIELD it sorts by them with any problem, but if they are after the ORDER BY FIELD, which is what I want, it just ignores them and just sorts by the ORDER BY FIELD statement.

I don't see why is this happening. Any idea? Thanks.

_________________
seo india
View user's profile
Hanratty



Joined: 04 Sep 2009
Posts: 1

PostPosted: Sat Sep 05, 2009 2:25 am Reply with quoteBack to top

try to do it in mysql server
View user's profile
Display posts from previous:      
Post new topicReply to topic


 Jump to:   



View next topic
View previous topic


Powered by phpBB © 2001, 2002 phpBB Group :: FI Theme