Create Virtual Column in mysql -
i have mysql query this:
$statement=$pdo->prepare("select id activity_id,type,status,description, (select sum(price*worked_hours) tbl_working_hours id_act = activity_id) total_hours tbl_activity");
there 2 tables:
1- tbl_activity
2- tbl_working_hours
i trying create virtual column each row based on summary table.
thanks
you might want use subqueries
select [...], (select count(*) mytable) count myothertable
thats solution comming mind. problem way pretty costly when comes performance.
Comments
Post a Comment