⚠ In case you've missed it we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This forum is read-only and soon will be archived. ⚠

Brian Pun

Member Since 27 Apr 2016
Offline Last Active May 06 2016 04:46 PM

Topics I've Started

SQL syntax error

27 April 2016 - 08:38 AM


$crud->columns('receipt_code', 'receipt_status', 'transaction_type', 'user_id', 'price', 'create_date', 'artwork_list', 'artwork_count', 'last_update_date', 'last_update_admin');
$crud->fields('receipt_code', 'receipt_status', 'transaction_type', 'user_id', 'price', 'remark', 'create_date', 'artwork_list');

$crud->set_relation('user_id', 'auth_users', '({vip_id}) {name}', array('is_admin' => 'not_admin'), 'vip_id ASC');
$crud->set_relation('last_update_admin', 'auth_users', 'name');

$artwork_list_relation = '{(SELECT `inventory_assessments`.`name` FROM `inventory_assessments` WHERE `inventory_assessments`.`assessment_id` = "20")}';
$crud->set_relation_n_n('artwork_list', 'inventory_artworks_transaction', 'inventory_artworks', 'receipt_id', 'artwork_id', '{inventory_artworks.artwork_code} - ' . $artwork_list_relation, 'priority', 'inventory_artworks.artwork_id NOT IN (SELECT inventory_artworks_transaction.artwork_id FROM inventory_artworks_transaction)');

I can directly query the sql to printout the result. But can to run in Grocerycrud