I have a custom hook_views which queries db for a webform submission. the query looks like this
$query = db_select('webform_submitted_data','n');
$query->leftJoin('webform_component', 'wc', 'wc.cid = n.cid');
$query->fields('n', array('sid','data','cid'));
$query->fields('wc', array('form_key','cid'))
->condition('n.nid',25)
Which translates to mysql:
select n.sid,n.cid,n.data,wc.form_key,wc.cid from webform_submitted_data n left join webform_component wc on wc.cid = n.cid where n.nid = 25
Now i have made a new field called status whose value can be 1 or 0, i want to show only those form submission whose status values are 1, I tried the following query in phpmyadmin but it gives out only 1 row output where the form_key value = status and data =1, where as the earlier query gave all the form_key, and data values for form id 25.
select n.sid,n.cid,n.data,wc.form_key,wc.cid from webform_submitted_data n left join webform_component wc on wc.cid = n.cid where n.nid = 25 and wc.form_key="status" and n.data =1
Is their any way by which i can add a views filter like condition here to show only data where status = 1