DEMO SITE v1.7.14

Subselect and sum row Default theme

Subselect() will create a new column with some value from other (or current) table. You can use any columns from current tables as parameters. Subselect will be called for each row

	$xcrud = Xcrud::get_instance();
    $xcrud->columns('customerName,city,creditLimit,Paid,Profit'); // specify only some columns
    $xcrud->subselect('Paid','SELECT SUM(amount) FROM payments WHERE customerNumber = {customerNumber}'); // other table
    $xcrud->subselect('Profit','{Paid}-{creditLimit}'); // current table
    $xcrud->sum('creditLimit,Paid,Profit'); // sum row(), receives data from full table (ignores pagination)
    $xcrud->change_type('Profit','price','0',array('prefix'=>'$')); // number format
    echo $xcrud->render();


1Signal Gift StoresLas Vegas71800$0.00
2Australian Collectors, Co.Melbourne117300$0.00
3Baane Mini ImportsStavern81700$0.00
4Mini Gifts Distributors Ltd.San Rafael210500152500$-58,000.00
5Zbyszek Zbyszek Piestrzeniewicz 1Warszawa1230$0.00
6Blauer See Auto, Co.Frankfurt59700$0.00
7Land of Toys Inc.NYC11490035321.97$-79,578.03
8Euro+ Shopping ChannelMadrid227600539928.6900000001$312,328.69
9Volvo Model Replicas, CoLuleå5310043680.65$-9,419.35
10Danish Wholesale ImportsKobenhavn8340079234.8$-4,165.20
Σ  7966218.127228496.590000002$-397,103.53 
Add Export into CSV Print