Using mySQL variables -


is possible in sequence of sql statements value of field , use name table in statement? i'm not sure if that's clear, here's psudo-example of i'm trying do:

// datatype equal "ratings" @var = select datatype thetable anid = 5;  // needs run "from ratings-table" select field1,field2 @var-table anid = 5; 

i've been reading http://dev.mysql.com/doc/refman/5.0/en/user-variables.html either don't understand this, or not solution i'm looking for.

yes, can using prepared statements:

set @tablename := 'ratings'; set @createquery := concat('select `field1`, `field2` `', @tablename, '-table` `anid` = 5'); prepare statementcreate @createquery; execute statementcreate; 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -