diff -ru webform-5.x-2.6/components/date.inc webform-5.x-2.6-sidfilter/components/date.inc
--- webform-5.x-2.6/components/date.inc	2009-01-10 04:12:15.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/date.inc	2009-03-02 17:59:52.000000000 +0200
@@ -320,18 +320,23 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_date($component) {
+function _webform_analysis_rows_date($component, $sids = array()) {
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
   $query = 'SELECT no,data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND  cid = %d '.
+    " AND  cid = %d $sidfilter".
     ' ORDER BY sid,no ASC ';
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   // build an array of timestamps from entered values.
   $timestamps = array();
   $submissions = 1;
diff -ru webform-5.x-2.6/components/email.inc webform-5.x-2.6-sidfilter/components/email.inc
--- webform-5.x-2.6/components/email.inc	2009-01-11 05:01:45.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/email.inc	2009-03-02 17:59:52.000000000 +0200
@@ -183,20 +183,25 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_email($component) {
+function _webform_analysis_rows_email($component, $sids = array()) {
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND cid = %d';
+    " AND cid = %d $sidfilter";
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   while ($data = db_fetch_array($result)) {
     if (drupal_strlen(trim($data['data'])) > 0) {
       $nonblanks++;
diff -ru webform-5.x-2.6/components/file.inc webform-5.x-2.6-sidfilter/components/file.inc
--- webform-5.x-2.6/components/file.inc	2009-02-14 09:19:33.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/file.inc	2009-03-02 17:59:52.000000000 +0200
@@ -463,20 +463,25 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_file($component) {
+function _webform_analysis_rows_file($component, $sids = array()) {
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND cid = %d';
+    " AND cid = %d $sidfilter";
   $nonblanks = 0;
   $sizetotal = 0;
   $submissions = 0;
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   while ($data = db_fetch_array($result)) {
     $filedata = unserialize($data['data']);
     if (isset($filedata['filesize'])) {
diff -ru webform-5.x-2.6/components/grid.inc webform-5.x-2.6-sidfilter/components/grid.inc
--- webform-5.x-2.6/components/grid.inc	2009-01-11 04:51:46.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/grid.inc	2009-03-02 17:59:52.000000000 +0200
@@ -235,23 +235,28 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema.
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_grid($component) {
+function _webform_analysis_rows_grid($component, $sids = array()) {
   // Generate the list of options and questions.
   $options = _webform_grid_options($component['extra']['options']);
   $questions = array_values(_webform_grid_options($component['extra']['questions']));
 
   // Generate a lookup table of results.
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
   $query = 'SELECT no, data, count(data) as datacount '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
     ' AND cid = %d '.
-    " AND data != '' ".
+    " AND data != '' $sidfilter ".
     ' GROUP BY no, data';
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   $counts = array();
   while ($data = db_fetch_object($result)) {
     $counts[$data->no][$data->data] = $data->datacount;
diff -ru webform-5.x-2.6/components/hidden.inc webform-5.x-2.6-sidfilter/components/hidden.inc
--- webform-5.x-2.6/components/hidden.inc	2009-01-09 10:31:14.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/hidden.inc	2009-03-02 17:59:52.000000000 +0200
@@ -121,20 +121,25 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_hidden($component) {
+function _webform_analysis_rows_hidden($component, $sids = array()) {
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND cid = %d';
+    " AND cid = %d $sidfilter";
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   while ($data = db_fetch_array($result)) {
     if (drupal_strlen(trim($data['data'])) > 0) {
       $nonblanks++;
diff -ru webform-5.x-2.6/components/select.inc webform-5.x-2.6-sidfilter/components/select.inc
--- webform-5.x-2.6/components/select.inc	2009-02-16 01:51:37.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/select.inc	2009-03-02 18:05:30.000000000 +0200
@@ -329,20 +329,25 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_select($component) {
+function _webform_analysis_rows_select($component, $sids = array()) {
   $options = _webform_select_options($component['extra']['items'], TRUE);
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
 
   $query = 'SELECT data, count(data) as datacount '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
     ' AND cid = %d '.
-    " AND data != '0' AND data != '' ".
+    " AND data != '0' AND data != '' $sidfilter ".
     ' GROUP BY data ';
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   $rows = array();
   while ($data = db_fetch_array($result)) {
     if (isset($options[$data['data']])) {
diff -ru webform-5.x-2.6/components/textarea.inc webform-5.x-2.6-sidfilter/components/textarea.inc
--- webform-5.x-2.6/components/textarea.inc	2009-02-14 22:08:27.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/textarea.inc	2009-03-02 17:59:52.000000000 +0200
@@ -154,20 +154,25 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_textarea($component) {
+function _webform_analysis_rows_textarea($component, $sids = array()) {
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND cid = %d';
+    " AND cid = %d $sidfilter";
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   while ($data = db_fetch_array($result)) {
     if (drupal_strlen(trim($data['data'])) > 0) {
       $nonblanks++;
diff -ru webform-5.x-2.6/components/textfield.inc webform-5.x-2.6-sidfilter/components/textfield.inc
--- webform-5.x-2.6/components/textfield.inc	2009-01-11 05:01:45.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/textfield.inc	2009-03-02 17:59:52.000000000 +0200
@@ -192,20 +192,25 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_textfield($component) {
+function _webform_analysis_rows_textfield($component, $sids = array()) {
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
   $query = 'SELECT data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    '  AND cid = %d';
+    "  AND cid = %d $sidfilter";
   $nonblanks = 0;
   $submissions = 0;
   $wordcount = 0;
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   while ($data = db_fetch_array($result)) {
     if (drupal_strlen(trim($data['data'])) > 0) {
       $nonblanks++;
diff -ru webform-5.x-2.6/components/time.inc webform-5.x-2.6-sidfilter/components/time.inc
--- webform-5.x-2.6/components/time.inc	2009-01-09 10:31:14.000000000 +0200
+++ webform-5.x-2.6-sidfilter/components/time.inc	2009-03-02 17:59:52.000000000 +0200
@@ -258,18 +258,23 @@
  * @param $component
  *   An array of information describing the component, directly correlating to
  *   the webform_component database schema.
+ * @param $sids
+ *   An optional array of submission IDs (sid). If supplied, the analysis will be limited
+ *   to these sids.
  * @return
  *   An array of data rows, each containing a statistic for this component's
  *   submissions.
  */
-function _webform_analysis_rows_time($component) {
+function _webform_analysis_rows_time($component, $sids = array()) {
+  $placeholders = count($sids) ? array_fill(0, count($sids), "'%s'") : array();
+  $sidfilter = count($sids) ?  "AND sid in (".implode(",", $placeholders).")" : "";
   $query = 'SELECT no,data '.
     ' FROM {webform_submitted_data} '.
     ' WHERE nid = %d '.
-    ' AND  cid = %d '.
+    " AND  cid = %d $sidfilter".
     ' ORDER BY sid,no ASC ';
 
-  $result = db_query($query, $component['nid'], $component['cid']);
+  $result = db_query($query, array_merge(array($component['nid'], $component['cid']), $sids));
   // build an array of timestamps from entered values.
   $timestamps = array();
   $submissions = 1;
diff -ru webform-5.x-2.6/webform_report.inc webform-5.x-2.6-sidfilter/webform_report.inc
--- webform-5.x-2.6/webform_report.inc	2009-02-14 05:19:04.000000000 +0200
+++ webform-5.x-2.6-sidfilter/webform_report.inc	2009-03-02 17:59:52.000000000 +0200
@@ -459,7 +459,7 @@
 /**
  * Provides a simple analysis of all submissions to a webform.
  */
-function webform_results_analysis($node) {
+function webform_results_analysis($node, $sids = array()) {
   $rows = array();
   $question_number = 0;
 
@@ -475,7 +475,7 @@
     // Do component specific call.
     $analysis_function = '_webform_analysis_rows_'. $component['type'];
     if (function_exists($analysis_function)) {
-      $crows = $analysis_function($component);
+      $crows = $analysis_function($component, $sids);
       if (is_array($crows)) {
         $row[0] = array('data' => '<strong>'. $question_number .'</strong>', 'rowspan' => count($crows) + 1, 'valign' => 'top');
         $row[1] = array('data' => '<strong>'. $component['name'] .'</strong>', 'colspan' => '10');
