Skip site navigation (1) Skip section navigation (2)

Re: Greater than a value

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "Fontenot, Paul" <Paul(dot)Fontenot(at)bannerhealth(dot)com>,<pgsql-novice(at)postgresql(dot)org>
Subject: Re: Greater than a value
Date: 2003-06-26 21:43:09
Message-ID: 200306261443.09329.josh@agliodbs.com (view raw or flat)
Thread:
Lists: pgsql-novice
Paul,

> select count(*),msg_text from msg_table where msg_text like '%PIX-1%'
> COUNT => '50' group by msg_text order by count desc;
> 
> Is that possible in PostgreSQL?

Yes.  You need an "intro to SQL" book to help you with this sort of thing; 
consider "SQL Queries for Mere Mortals".

SELECT count(*) as no_msg, msg_text FROM msg_table
WHERE msg_text LIKE '%PIX-1%'
GROUP BY msg_text
HAVING count(*) >= 50
ORDER BY no_msg DESC;


-- 
-Josh Berkus
 Aglio Database Solutions
 San Francisco


In response to

pgsql-novice by date

Next:From: Rudi StarcevicDate: 2003-06-26 23:08:13
Subject: Address Table
Previous:From: Nabil SayeghDate: 2003-06-26 21:27:20
Subject: Re: Fw: Removing foreign key and adding sequence

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group