Show all rows from a table with a SQL query, not retrieve.
Author: None (None)
Hello.
I want to execute a sql that have to do the query from different tables (24 tables with this format CC_01 to CC_24), all the tables have the same definition (the model was defined this way instead of making all in 1 table with an extra field for an implementation issue). The $$var_for_table_name is given by a dropdown list and the $$var_for_key is given by a normal var of the system.
For example:
sql "SELECT field1,field2,field3 FROM '%%$$var_for_table_name' WHERE primary_key ='%%$$var_for_key'
I need to show something like this (f.e. 3 rows returned):
field1 - field2 - field3
1a - 1b - 1c
2a - 2b - 2c
3a - 3b - 3c
If the result bring back several rows, I don't know how to show them all, like in a grid , cause when the result is only 1 row it can be show with $result.
If this can't be done or is too difficult, how can I implement 'read where' for a variable table? All of this have to be done in 1 form, my solution of openning 24 different forms depending on the dropdown list isn't a great solution.
Thanks for reading.




