C.R. Vegelin wrote:
Hi, I am looking for a method to use variable table names.
I have various download-tables, all having the same structure.
All I want is to run a series of queries on each of these tables.
I tried
SET @mytable = 'Download200501';
SELECT count(*) FROM @mytable;
but this doen't work. Is there any way to work around this ?
Thanks, Cor
Cor,
In http://dev.mysql.com/doc/mysql/en/variables.html it states that
" User variables may be used where expressions are allowed. This does
not currently include contexts that explicitly require a literal value,
such as in the LIMIT clause of a SELECT statement, or the IGNORE number
LINES clause of a LOAD DATA statement. "
Since the table name in the SELECT syntax cannot be an expression, you
can't use variables here.
I think this is a job for the programming environment / shell that you use.
Regards, Jigal.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]