Skip to main content
Add link to module.
Source Link
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
]);

Update 19 October 2018

I've created a module to make it easier to query webform submissions by submission field values. See: https://www.drupal.org/project/webform_query

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
]);

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
]);

Update 19 October 2018

I've created a module to make it easier to query webform submissions by submission field values. See: https://www.drupal.org/project/webform_query

Code formatting.
Source Link
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"'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"'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
]);

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
]);

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
]);
Remove closing semicolon in static query example.
Source Link
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
]);

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
]);

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
]);
Source Link
imclean
  • 1.1k
  • 10
  • 18
Loading