pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Hartwig <daveh@insightdist.com>
To: jpmarichal@infoacces.com
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Equivalent for an Access query
Date: Wed, 27 Jan 1999 13:04:15 -0500
Message-ID: <36AF551F.9C16AE1E@insightdist.com> (raw)
References: <199901271058390710.005380C0@infoacces.com>



Juan Pablo Marichal Catalan wrote:

> I'm building a system to a contest. I have three tables: participantes (partakers), ordenes (orders) and productos (products). Partakers on the contest introduce their id in an HTML form, then this calls a PHP to query the database and return data taken from the three tables.
>
> Using Microsoft Access, I get the SQL code for the query, then I copy it and paste it in my PHP code:
>
> $result=pg_Exec($conn,"SELECT participantes.idven, participantes.nombreven, participantes.iding, participantes.nombreing, participantes.empresa, ordenes.num_ordenuf, ordenes.factura_spasp, ordenes.factura_vad, ordenes.fecha, ordenes.num_producto, productos.descripcion, ordenes.mayorista, productos.puntos, ordenes.cantidad, [puntos]*[cantidad] AS Total FROM productos INNER JOIN (participantes INNER JOIN ordenes ON idven = participante) ON idproducto = num_producto WHERE (((idven)="VHA1901081"))");
>
> But Postgress don't accept the . operator, so it drops to me those nasty 'parse' error messages. I don't know if it's only due to the . operator, or the use of upper case or what. How must I build the SQL query to be accepted by Postgress and PHP? I'm drowning on it!
>

This generally is not a good idea.    There are several syntax structures here which will give PostgreSQL trouble.   Such as:
    INNER JOIN  - syntax not supported yet
    [puntos]*[cantidad] -  PostgreSQL uses double quote as identified delimiters.

If you wish to continue down this path let me suggest a few items.

1.  set the query property to "snapshot"
2.  activate the CommLog in the driver.
3.  cut your statements out of the CommLog.

The MS Jet and the ODBC driver, PostgreSQL'ify them before they get to the server.

Hope this helps.










view thread (4+ messages)  latest in thread

Message-ID: <36AF551F.9C16AE1E@insightdist.com>
Permalink:  ../36AF551F.9C16AE1E@insightdist.com/
Also on:    postgresql.org/message-id/36AF551F.9C16AE1E@insightdist.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: daveh@insightdist.com, jpmarichal@infoacces.com
  Subject: Re: [SQL] Equivalent for an Access query
  In-Reply-To: <36AF551F.9C16AE1E@insightdist.com>
  References: <199901271058390710.005380C0@infoacces.com> <36AF551F.9C16AE1E@insightdist.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox