[SQL] Making a prepared statement in a stored procedure

2004-12-30 Thread Nathan Pickett
Hi, I am trying to convert the following function below: ---START FUNCTION create or replace function update_tmp_sales_report_from_archive_with_prospects() returns integer as ' declare row_data record; begin for row_data in select partner_id, count(*) as prospects from prospects_2004_09_01 group

[SQL] Problem with subquery containg GROUP BY

2004-12-30 Thread Ishay Pomerantz
Hi, I’m using postgres 7.4.   I have two queries: (1) SELECT  a,b FROM table1 WHERE a=99   (2) SELECT  a,b,sum (o)  as sum_o FROM table2 GROUP BY a,b   Both Runs very fast.   But when I try to make (2) as a subquery of (1):   SELECT  a,b,sum_o FROM table1 LEFT JOIN  ( S

Re: [SQL] [GENERAL] Get current trasanction id

2004-12-30 Thread Martijn van Oosterhout
I'm sure there's many tricky ways, but one simple way would be to insert a row into a table and then grab its XMIN value... Hope this helps, On Mon, Dec 27, 2004 at 09:52:57AM +0100, Marek Lewczuk wrote: > Hello, > is there any way to get current transaction id using plpgsql or sql ? > > Thanks

[SQL] Making a prepared statement in a stored procedure

2004-12-30 Thread Nathan Pickett
Hi, I am trying to convert the following function below: ---START FUNCTION create or replace function update_tmp_sales_report_from_archive_with_prospects() returns integer as ' declare row_data record; begin for row_data in select partner_id, count(*) as prospects from prospects_2004_09_01

[SQL] Function in C++

2004-12-30 Thread Jose Mendoza
  I would like to have, only if it is possible, a small example of how can be that done. I have this problem now because I have a very light interface using the ODBC and with the same code I can connect to Postgresql (servers Linux) and SQLserver (servers Windows). And the libpq++ works in