Re: [SQL] operating "inet" type

2005-04-13 Thread Bruno Wolff III
On Tue, Apr 12, 2005 at 20:34:04 +0800,
  "Ilya A. Kovalenko" <[EMAIL PROTECTED]> wrote:
> 
>   You can do integer compare two "inet" values, but you can't do
> integer increment (i.e. increment inet value by integer).

It would probably be useful to have some way of generating a list of
addresses in a subnet. Being able to increment addresses and having a
way to get the highest and lowest addresses in a subnet would give you
a way to do that.

>   I understand, that developers has more important things to do, but
> they left "inet" type w/o any ways to work w/ it.

You can write your own functions to do this. It is possible that they
could go back into the code base if they seem generally useful.

If you are interested in getting them back into the code base, you are probably
best off proposing specs for the functions on the hackers lists for comments,
before writing them.

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [SQL] max question

2005-04-13 Thread Bruno Wolff III
On Tue, Apr 12, 2005 at 12:24:21 -0500,
  "A. R. Van Hook" <[EMAIL PROTECTED]> wrote:
> I have the following in a table:
>   oid   |   citkey   |  contby  |  contdate  | abcontinue |   ccdate  
> -++--+++
> 5774835 | 04-0594703 |  |||
> 5775325 | 04-0594703 | Attorney | 04/06/2005 | 6  | 03/07/2005
> 5776060 | 04-0594703 | Attorney | 05/04/2005 | 6  | 04/05/2005
> 5776067 | 04-0594703 | Attorney | 05/04/2005 | 6  | 04/05/2005
> 
> I am trying to pull rows that have the max. contdate. Why does the 
> following give more than 2 rows?
> ql "select oid,* from ccontinue where citkey ='04-0594703' group by 
> oid,citkey,contby,contdate,abcontinue,ccdate having max(contdate) = 
> contdate"

If you group by oid you are going to get a separate group for each row.
You haven't told us what you actually expect for output, so I don't
have specific advise for a query. However, you might find the Postgres
extension DISTINCT ON useful, depending on exactly what you want.

>   oid   |   citkey   |  contby  |  contdate  | abcontinue |   ccdate  
> -++--+++
> 5776067 | 04-0594703 | Attorney | 05/04/2005 | 6  | 04/05/2005
> 5775325 | 04-0594703 | Attorney | 04/06/2005 | 6  | 03/07/2005
> 5776060 | 04-0594703 | Attorney | 05/04/2005 | 6  | 04/05/2005
> (3 rows)
> 
> thanks
> 
> 
> ---(end of broadcast)---
> TIP 5: Have you checked our extensive FAQ?
> 
>   http://www.postgresql.org/docs/faq

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly