Re: EUSQL select statement

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu