X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 12713D1B4A8 for ; Thu, 20 May 2004 11:47:51 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 75049-04 for ; Thu, 20 May 2004 11:47:34 -0300 (ADT) Received: from mail.gmx.net (imap.gmx.net [213.165.64.20]) by svr1.postgresql.org (Postfix) with SMTP id 41E16D1B17B for ; Thu, 20 May 2004 11:46:46 -0300 (ADT) Received: (qmail 6085 invoked by uid 65534); 20 May 2004 14:46:48 -0000 Received: from p508BEB58.dip.t-dialin.net (EHLO gmx.net) (80.139.235.88) by mail.gmx.net (mp013) with SMTP; 20 May 2004 16:46:48 +0200 X-Authenticated: #14269776 Message-ID: <40ACC4CA.4080406@gmx.net> Date: Thu, 20 May 2004 16:46:34 +0200 From: Andreas User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; de-AT; rv:1.7b) Gecko/20040316 X-Accept-Language: de-de, en-us, en MIME-Version: 1.0 To: Andrei Bintintan Cc: pgsql-sql@postgresql.org Subject: Re: where to start with this procedure ? References: <40ABFCDE.8020601@gmx.net> <00bb01c43e3a$7d33f980$0b00a8c0@forge> In-Reply-To: <00bb01c43e3a$7d33f980$0b00a8c0@forge> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200405/176 X-Sequence-Number: 17890 Hi Andrei, >Use the Offset and Limit in the SQL query. >[...] >SELECT select_list > FROM table_expression > WHERE condition > LIMIT 50 > OFFSET 10000 > >This query will return 50 elements starting with the 10000 elements... so >the elemenst from 10000 to 10050. > > That isn't the issue since I only need a specific few of the lines at all. I need a dynamic WHERE clause. It's more like this : SELECT customer_id, and, some, more, fields FROM table1 JOIN table2 JOIN table3 .... This results in the "huge" set. On the Access-form I only need the orders, or contact history for 1 customer. As of now I only know 2 ways to solve this. 1) Load all the tables over the net into Access and let the JOIN run locally. That way I can filter dynamically by adding a WHERE customer_id = x to the select above. 2) Let the JOINS run in a server based view and transfer the whole result into Access to fetch the few lines regarding the customer. There should be something like: 3) a) Access calls a server based function with the customer_id as parameter. b) The function calls the server based view and filters the result acording to it's parameter. c) The function sends only the actually wanted lines back to Access.