Search for the sum of the points. The condition is that from the data table whose name is equal to the param value, the uid with id equal to the param_id value is equal to 3 SELECTsum (point) FROMfirWHERE (SELECTuidFROMfir. paramWHEREidfir. param_id) & #039; 3 & #039; The above statement is fir. param is actually a database fi... search for the sum of points. The condition is that, from the data table whose name is equal to the param value, the uid with id equal to the param_id value is equal to 3.
SELECT sum(point) FROM fir WHERE (SELECT uid FROM fir.param WHERE id = fir.param_id) = '3'
The above statement, fir. param, is actually the value of a field in the database fir. It stores the name of the second or third database (such as the sec), but an error is returned. What should I do?
firparam | param_id | pointsec | 11 | 10third | 23 | -20sec | id | uid11 | 3third | id | uid23 | 3
Reply content:
Search for the sum of points. The condition is that, from the data table whose name is equal to the param value, the uid with id equal to the param_id value is equal to 3.
SELECT sum(point) FROM fir WHERE (SELECT uid FROM fir.param WHERE id = fir.param_id) = '3'
The above statement, fir. param, is actually the value of a field in the database fir. It stores the name of the second or third database (such as the sec), but an error is returned. What should I do?
firparam | param_id | pointsec | 11 | 10third | 23 | -20sec | id | uid11 | 3third | id | uid23 | 3
The syntax of this statement is incorrect. From fir. param... but in fact, fir is the table name And param is the column name?
We recommend that you do not write statements. Write out your requirements, and write out the expected execution results.
The author actually saves the table name as a field, finds the table name based on the condition, and finally obtains the data. This operation cannot be completed in an SQL statement. You can try the view or stored procedure.