homepage Welcome to WebmasterWorld Guest from 54.197.108.124
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
sort by numrows ?
dav_999




msg:3859736
 10:27 am on Feb 28, 2009 (gmt 0)

is there any way to sort mysql results by number of rows example
i have two tables
--
one
id
title
data
--

--
two
id
title
--

now both table have the same data in title

example
(table1)title=ex1
(table1)title=ex2
----
(table2)title=ex1
(table2)title=ex1
(table2)title=ex2
----

now i want to do is searching the table one with the title ex1
with like %ex%

the result should show the both ex1 and ex2
and i want to sort them with the numrows i get from table2.
DESC, so the ex1 should be 1st and ex2 2nd any idea ?

 

coopster




msg:3870050
 10:48 pm on Mar 13, 2009 (gmt 0)

I believe you should be able to GROUP BY title and ORDER BY a COUNT in DESC order

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved