[SQL] find the "missing" rows

2004-12-01 Thread Kevin B.
I would like to find the "missing" rows between two sets without using a subselect (or views). This query finds the rows that are in t1 but not in t2. (see the script below for table definitions.) QUERY 1: select * from t1 left join t2 on t1.i = t2.i where t2.i is null The above query i

[SQL] filtering

2004-12-10 Thread Kevin B.
Hi, I have a 14 million row table with one index on two fields one is a varchar the other is a date. The combination of the two makes the row unique. Data - name date... other fields a 1/1/01 a 1/2/01 a 1/3/01 b 1/1/01 b 1/2/01 d 1/1/01 d 1/2/01

[SQL] assign the row count of a query to a variable

2005-01-14 Thread Kevin B.
Hi, I'm trying to assign the row count of a query to a variable in a function but I'm not having any luck. Could someone tell me the syntax? I've been looking in the docs and googling for a long time but just can't find the answer. I've tried: CREATE OR REPLACE FUNCTION ret1() RETURNS int4 AS '