Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 769 Bytes

how-to-make-subquery.md

File metadata and controls

28 lines (23 loc) · 769 Bytes

How To Make A Subquery Column at Grid Data

Table : Products

Field Name Data Type
id int (PK)
name varchar(255)
description varchar(255)

Table : Favorite

Field Name Data Type
id int(PK)
members_id int(11)
products_id int(11)

Products

$this->col[] = ["label"=>"Name","name"=>"name"];
$this->col[] = ["label"=>"Description","name"=>"description"];
$this->col[] = ["label"=>"Total Favorite","name"=>"(select count(favorite.id) from favorite where favorite.products_id = products.id) as total_favorite"];

What's Next

Table Of Contents