[Date Prev][Date Next][Thread Prev][Thread Next][Minivend by date
][Minivend by thread
]
Re: SQL query
On Thu, 17 Jun 1999, peter hicks wrote:
> The following minivend tag generates a number that I want to use as a
> product code in a sql query:
>
> [data base="club" field="product_id" key="er1"]
>
> But when I use this tag in the following query, it generates an error
> that says Bad SQL query selector: 'type=list' for products:
>
> [sql type=list
> query="select * from products where code like '[data base="club"
> field="product_id" key="er1"]'
> "]
> [sql-param code] [sql-param title]<BR>
> [/sql]
>
>
> What is the proper way to accomplish this? Thank you in advance!
Try
select * from products, club where products.code = 'club.product_id' and\
club.code = 'er1'
The products fields are returned first, i.e. [sql_param 0] - sql_param n]
followed by the fields from club, [sql_param n+1] ...
You may want to change the "select *" to "select products.x, products.xx, ..."
where just the fields you need are returned.
Dan
--
Dan Busarow 949 443 4172
Dana Point Communications, Inc. dan@dpcsys.com
Dana Point, California 83 09 EF 59 E0 11 89 B4 8D 09 DB FD E1 DD 0C 82
- References:
- SQL query
- From: peter hicks <peter@libation.com>