[SQL] return records with more than one occurrences

2011-01-06 Thread Tarsis Lima
how would the SELECT to  return only records with more than one
occurrences  of id_table1? example:
 -- Table1
 -- id --
-
1
2


-- Table2
   id  --- | id_table1 | name
  --
   4   | -  1 -- |   Tom
   5   | -  1 -- |   Luci
   6   | -  2 -- |  Cleber   -->this can not return




-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] pattern matching with dates?

2011-01-06 Thread Good, Thomas
This dubious query worked well previously:
select * from db_log where log_date LIKE '2011-01-%';
(currently works on bluehost.com where they run 8.1.22)

Can someone offer a (preferably ANSI compliant) way to do this on 8.4.5?

I realize that >= and so on work well (which may explain why the docs
are pretty silent about pattern matching with dates) but sometimes it's nice to 
treat the (ISO) date as a string.

thanks much,
Tom
--
Thomas Good, Senior Database Administrator
Saint Vincent's Hospital Westchester
A Division of Saint Joseph's Medical Center
Residential Services
75 Vanderbilt Avenue, Room 5-47
Staten Island, NY 10304
718.818.5528

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql