Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh

Example How do I write a left join query in Drupal 8:

in this Example field_type is a List(text) field.

    $db = \Drupal::database();
    $query = $db->select('node_field_data', 'n');
    $query->condition('n.type', $node_type, '=')
        ->condition('n.status', '1', '=')
        ->fields('n', array('nid'))
        ->fields('n', array('title'));
    $query->leftJoin('node__field_type', 'n1', 'n1.entity_id = n.nid');
    $query->condition('n1.field_type_value', $type);
    $query->range(0, 1);

Riadh Rahmi

Senior Web Developer PHP/Drupal & Laravel

I am a senior web developer, I have experience in planning and developing large scale dynamic web solutions especially in Drupal & Laravel.

Web Posts


Page Facebook