Monday, January 13, 2014

Select Query with multiple conditions

Like we use

Select * from tablename where this=that and this=that

we can do same in Drupal7 as follows

 $query1 = db_select('field_data_field_coupon_date1','f')->fields('f')->condition('entity_id',$enitiy_id,'=')->condition('revision_id',$revision_id,'=')->condition('field_coupon_date1_value',$date,'='); 
$result1 = $query1->execute();
$row1 = $result1->fetchAssoc();

No comments:

Post a Comment