Skip to main content
1 of 4
imclean
  • 1.1k
  • 10
  • 18

The table "webform_submission_data" uses the EAV model. To extract useful results you can use a static query.

Example SQL to the get sid meeting all the requirements:

SELECT DISTINCT sid
   FROM webform_submission_data wsd
     WHERE wsd.webform_id = 'ticket'
     AND sid IN (SELECT sid FROM webform_submission_data wsd2                   
                  WHERE wsd2.name = "ticket_for"
                    AND wsd2.value CONTAINS '$adnummer')
     AND sid IN (SELECT sid FROM webform_submission_data wsd3
                  WHERE wsd3.name = 'entity_id'
                    AND wsd3.value = $eventID);

Example static query:

$query = $connection->query("SELECT DISTINCT sid
   FROM webform_submission_data wsd
     WHERE wsd.webform_id = 'ticket'
     AND sid IN (SELECT sid FROM webform_submission_data wsd2                   
                  WHERE wsd2.name = "ticket_for"
                    AND wsd2.value CONTAINS :adnummer)
     AND sid IN (SELECT sid FROM webform_submission_data wsd3
                  WHERE wsd3.name = 'entity_id'
                    AND wsd3.value = :event_id);", [
  ':adnummer' => $adnummer,
  ':event_id' => $eventID
]);
imclean
  • 1.1k
  • 10
  • 18