sql - How to order the query result by count() of field in postgresql without group by -


I have a simple database and I think my answer should be so simple, but I could not find the answer that DB It looks like:

  ----------------- name. IP ----------------- Nick | 192.168.1.10 Zone | 19 2.168.1.1 Zone | 19.268.1.2 Zone | 1920.168.13 Lucy. 1920.168.10.1 Lucy | 1920.168.10.2.  

I need a query that returns all the rows, but the sequence of results per IP (IP) and the result of the above list should be something similar:

< Pre> ------------------ Name | IP ------------------ Nick | 192.168.1.10 Lucy | 1920.168.10.1 Lucy | 192.168.10.2 Zone | 192.168.1.1 Zone | 19.2.18.1.2 Zone | 1920.168.1.3

Try this query:

  SELECT t1. * Join table 1 t1 INNER (SELECT Count (name) counter, name from name table1 GROUP by name) t2 ON t1.name = t2.name by ORDER counter;  


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -