Re: SQl query

From: "Victor Yegorov" <viy(at)nordlb(dot)lv>
To: Abdul Wahab Dahalan <wahab(at)mimos(dot)my>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: SQl query
Date: 2003-05-07 08:57:28
Message-ID: 20030507085728.GQ17892@nordlb.lv
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

* Abdul Wahab Dahalan <wahab(at)mimos(dot)my> [07.05.2003 11:52]:
> If I've a transport table like this:
> transporttype | transportid
> ---------------+-------------
> Lorry | 1037
> Pickup | 1038
> Lorry | 1040
> Lorry | 1045
> Pickup | 1046
> Lorry | 1047
>
> How do I make a query so that I get a result like
>
> transporttype | #of transport
> ---------------+-------------
> Lorry | 4
> Pickup | 2

select
transporttype,
count(transporttype)
from
your_table
group by
transporttype;

--

Victor Yegorov

In response to

  • SQl query at 2003-05-07 08:20:21 from Abdul Wahab Dahalan

Browse pgsql-sql by date

  From Date Subject
Next Message DIB Walid 2003-05-07 09:00:04 Re: SQl query
Previous Message Matthew Horoschun 2003-05-07 08:34:20 Re: SQl query