Need query

From: Gaurav Jindal <gaurjin(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Need query
Date: 2014-04-11 16:18:37
Message-ID: CAFWM-9s9c5HZBEovH+FRHBfdcpBa8c1w-L2T-wjzhPi0-DC+ag@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Can anybody help me with query-

I have 3 tables- a,b,c

a has relation with b and b has relation with c
a does not have a relation with c

I need to find top performing item in table 'a'. It is based on count. If
more count, it is top performing. We can count only based on actions in
table 'c'. I can put 'where' clause in table 'c' and find those values. I
can't join table 'a' and 'c' as they don't have any relation.

select b.top
FROM b,c
WHERE c.action IN ('blah', 'blah', 'any values') and b.id = c.id;

'top' in the query is a common column in table 'a' named 'a_top'. We need
to count column 'track' in table 'a' based on this information.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bala Venkat 2014-04-11 16:21:31 Re: postgresql.conf question... CPU spikes
Previous Message Andy Colson 2014-04-11 16:10:52 Re: efficient way to do "fuzzy" join