mercredi 5 août 2015

Create Virtual Column in mysql


I have mysql query like this:

$statement=$pdo->prepare("SELECT id AS Activity_ID,type,status,description,
(SELECT SUM(price*worked_hours) FROM tbl_working_hours 
WHERE id_act = Activity_ID) AS total_hours FROM tbl_activity");

There is two tables:

1- tbl_activity

2- tbl_working_hours

I am trying to create virtual column for each row based on summary from another table.

Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire