I'm new to postgres.
I've got 2 SQL statements I would like to combine
into one.
I think I need to use a sub select or join I am not
sure.
Any help would be appreciated!
statement 1: SELECT uid, count(uid) FROM triangulated WHERE uid !=
'anonymus' AND uid
!= 'anonymous' AND uid != '' GROUP BY uid ORDER BY count DESC LIMIT 10; that returns something like this:
uid |
count
-------------+------- eblevins | 1179 DaClyde | 398 Drew | 30 zombiechick | 3 (4 rows) statement 2: SELECT uid,
count(uid) FROM points WHERE uid != 'anonymus' AND uid !=
'anonymous' AND uid != '' GROUP BY uid ORDER BY count DESC LIMIT 10; that returns something like this:
uid | count -------------+------- eblevins | 23595 DaClyde | 11031 zombiechick | 159 Drew | 104 (4 rows) what I want to do is have one statement that
returns something like this:
uid |
count1 | count2
eblevins 1179
23595
DaClyde 398
11031
Drew 30
104
zombiechick 3
159
So everything is ordered like statement 1 but
includes the count(uid) from the points DB like statement 2 returns
Any ideas on an effecient way of doing
this?
|
- Re: [SQL] Help with SQL Eric L. Blevins
- Re: [SQL] Help with SQL Oliver Elphick
- Re: [SQL] Help with SQL Eric L. Blevins