1. EUSQL select statement
- Posted by sixs <sixs at ida.net>
Nov 01, 2004
Hello Matt,
I want the select statement to be able to select the different tables in
the database. I have sevveral tables., so I could have eight
statements and have to select one of the eight statements to execute
the , but I hoped to have just one statement.
The user will select the table and it will be in a edittext field.
The user will choose the table. For instance tablex = table1, table2, etc.
the select statement
"select * from tablex where tablex. keyx = valuex;"
HCATID = tablex ; MEID and HMEID = keyx in tablex
HMEID and HCATID are values creaed from the set parameter command
sql = "SELECT * FROM [HCATID] WHERE VAL(MEID) = [HMEID];"
Thanks
Jim
2. Re: EUSQL select statement
sixs wrote:
>
> Hello Matt,
> I want the select statement to be able to select the different tables in
> the database. I have sevveral tables., so I could have eight
> statements and have to select one of the eight statements to execute
> the , but I hoped to have just one statement.
> The user will select the table and it will be in a edittext field.
>
> The user will choose the table. For instance tablex = table1, table2, etc.
> the select statement
> "select * from tablex where tablex. keyx = valuex;"
> HCATID = tablex ; MEID and HMEID = keyx in tablex
> HMEID and HCATID are values creaed from the set parameter command
>
>
> sql = "SELECT * FROM [HCATID] WHERE VAL(MEID) = [HMEID];"
>
OK. You can't do this. :) When I need to do somethink like this,
I use sprintf:
sql = sprintf( "SELECT * FROM %s WHERE %s.%s = %s;", {table, table, key, val})
Parameters can only be placeholders for actual values. They are a way
to change those values after the query has been parsed. Once a query
is parsed, it's too late to change tables. Hope that makes sense.
Matt Lewis