Could somebody make this code below efficient? Is it possible to this query one time like:SELECT * FROM user_target WHERE uid=3 LIMIT 1
store the result in a variable and use "user_target.m10" to calculate.The storage that I tried @user_target doesn't allow more than one column.SELECT id, ((m10/population*(SELECT m10 FROM user_target WHERE uid=3))+ (m20/population*(SELECT m20 FROM user_target WHERE uid=3))+ (m30/population*(SELECT m30 FROM user_target WHERE uid=3))+ (m40/population*(SELECT m40 FROM user_target WHERE uid=3))+ (m50/population*(SELECT m50 FROM user_target WHERE uid=3))+ (m60/population*(SELECT m60 FROM user_target WHERE uid=3))+ (m70/population*(SELECT m70 FROM user_target WHERE uid=3))+ (m80/population*(SELECT m80 FROM user_target WHERE uid=3))+ (m90/population*(SELECT m90 FROM user_target WHERE uid=3))+ (m100/population*(SELECT m100 FROM user_target WHERE uid=3))) FROM data_population
Anybody?Thanks