<?xml version="1.0" encoding="windows-1252"?>
<node id="399662" title="erix's scratchpad" created="2004-10-15 17:01:20" updated="2005-08-10 22:26:50">
<type id="182711">
scratchpad</type>
<author id="399498">
erix</author>
<data>
<field name="doctext">
&lt;c&gt;
----------------------------------------------------
-- data of the OP:

select * from (values(1,'A'),(2,'A'),(3,'A'),(3,'B'),(4,'B')) as f(id, type);


select *
from (
    select  id
        ,   sum(case type when 'A' then 1 else 0 end)   as a_count
        ,   sum(case type when 'B' then 1 else 0 end)   as b_count
    from  (values(1,'A'),(2,'A'),(3,'A'),(3,'B'),(4,'B')) as f1(id, type) --  your_table
    group by 1
) as f2
where a_count &gt; 0 and b_count &gt; 0;
----------------------------------------------------

&lt;/c&gt;


&lt;c&gt;

&lt;/c&gt;


&lt;c&gt;

Can you color Ratty?
                        ___              
                       /  \\
                ______ \  //
               /      \/ o \
      ________/             \
              \_  \__\ \-----o
               \____|\__|


&lt;/c&gt;

&lt;c&gt;
--
--  Windows dev Install:
--
Installing postgres on windows as a unpriviledged user (avoiding the necessity of administrator rights):

-- download zip file;
 http://www.enterprisedb.com/products-services-training/pgbindownload
      "Binaries from installer version 9.2.2"

-- unzip the pgsql directory somewhere, and cd into it:
      cd pgsql

-- run initdb:
      bin\initdb -D 9.2\data

-- to start postgres:
      "bin\pg_ctl" -D "9.2/data" -l logfile start

-- to stop: close all connections, and then run:
      "bin\pg_ctl" -D "9.2/data" -l logfile stop 

default port will be: 5432

(Install DBI + DBD::Pg to connect via perl )

I ran this on a rather old win2k, but it will probably also work on newer windows.

(wiggle slashes a bit and it will work on linux too (with the proper file download, of course))

perl -MDBI -Mstrict -e 'my$dbh=DBI-&gt;connect("dbi:Pg:port=5432;db=postgres;", undef, undef,{RaiseError=&gt;1}); print $dbh, "\n"';

output:
DBI::db=HASH(0x1b5a808)

-&gt; apparently the connection succeeded


&lt;/c&gt;</field>
</data>
</node>
