Index: trunk/MagicSoft/Mars/datacenter/db/runinfo-aio.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/runinfo-aio.php	(revision 9089)
+++ trunk/MagicSoft/Mars/datacenter/db/runinfo-aio.php	(revision 9105)
@@ -48,5 +48,7 @@
             else
             {
-                $query0 .= " RunData.fRunNumber as 'Run#' ";
+//                $query0 .= " RunData.fRunNumber as 'Run#' ";
+//                $query0 .= " Concat(RunData.fTelescopeNumber,':', RunData.fRunNumber,':', RunData.fFileNumber) as 'Run' ";
+                $query0 .= " Concat(RunData.fTelescopeNumber,':', RunData.fRunNumber,':', RunData.fFileNumber) as 'Tel:Run:File' ";
 
                 if (empty($_GET["fSendTxt"]) && !empty($_GET["fLinks"]))
@@ -65,5 +67,5 @@
         $query0 .= " FROM RunData ";
 
-        $query0 .= " LEFT JOIN RunProcessStatus ON RunData.fRunNumber=RunProcessStatus.fRunNumber ";
+        $query0 .= " LEFT JOIN RunProcessStatus USING(fRunNumber,fTelescopeNumber,fFileNumber) ";
 
         foreach ($_GET as $key => $element)
@@ -74,5 +76,5 @@
         {
             if ($_GET["fSourceName"]!="On")
-                $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
+                $query0 .= " LEFT JOIN Source USING(fSourceKEY) ";
             $query0 .= " WHERE fTest='no'";
         }
@@ -262,5 +264,4 @@
         printf(" <P>\n");
         PrintSourceMenu($host,$user,$pw,$db);
-        PrintNumResPullDown();
         printf("<p>");
         printf("</div>");
@@ -271,4 +272,5 @@
         ini_set("display_errors", "Off");
 
+        PrintNumResPullDown();
         PrintButtons("runinfo-aio.php");
 
Index: trunk/MagicSoft/Mars/datacenter/db/runinfo.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/runinfo.php	(revision 9089)
+++ trunk/MagicSoft/Mars/datacenter/db/runinfo.php	(revision 9105)
@@ -59,5 +59,5 @@
         $query0 .= " FROM RunData ";
 
-        $query0 .= " LEFT JOIN RunProcessStatus ON RunData.fRunNumber=RunProcessStatus.fRunNumber ";
+        $query0 .= " LEFT JOIN RunProcessStatus USING(fRunNumber,fTelescopeNumber,fFileNumber) ";
 
         foreach ($_GET as $key => $element)
@@ -68,5 +68,5 @@
         {
             if ($_GET["fSourceName"]!="On")
-                $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
+                $query0 .= " LEFT JOIN Source USING(fSourceKEY) ";
             $query0 .= " WHERE fTest='no'";
         }
Index: trunk/MagicSoft/Mars/datacenter/db/sequence.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/sequence.php	(revision 9089)
+++ trunk/MagicSoft/Mars/datacenter/db/sequence.php	(revision 9105)
@@ -38,17 +38,17 @@
         $query0 .= " FROM Sequences ";
 
-        $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
-        $query0 .= " LEFT JOIN Project ON Sequences.fProjectKEY=Project.fProjectKEY ";
-        $query0 .= " LEFT JOIN HvSettings ON Sequences.fHvSettingsKEY=HvSettings.fHvSettingsKEY ";
-        $query0 .= " LEFT JOIN DiscriminatorThresholdTable ON Sequences.fDiscriminatorThresholdTableKEY=DiscriminatorThresholdTable.fDiscriminatorThresholdTableKEY ";
-        $query0 .= " LEFT JOIN L1TriggerTable ON Sequences.fL1TriggerTableKEY=L1TriggerTable.fL1TriggerTableKEY ";
-        $query0 .= " LEFT JOIN L2TriggerTable ON Sequences.fL2TriggerTableKEY=L2TriggerTable.fL2TriggerTableKEY ";
-        $query0 .= " LEFT JOIN TriggerDelayTable ON Sequences.fTriggerDelayTableKEY=TriggerDelayTable.fTriggerDelayTableKEY ";
-        $query0 .= " LEFT JOIN TestFlag ON Sequences.fTestFlagKEY=TestFlag.fTestFlagKEY ";
-        $query0 .= " LEFT JOIN LightConditions ON Sequences.fLightConditionsKEY=LightConditions.fLightConditionsKEY ";
-        $query0 .= " LEFT JOIN ManuallyChanged ON Sequences.fManuallyChangedKEY=ManuallyChanged.fManuallyChangedKEY ";
-        $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
-        $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst ";
-        $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst ";
+        $query0 .= " LEFT JOIN Source USING(fSourceKEY) ";
+        $query0 .= " LEFT JOIN Project USING(fProjectKEY) ";
+        $query0 .= " LEFT JOIN HvSettings USING(fHvSettingsKEY) ";
+        $query0 .= " LEFT JOIN DiscriminatorThresholdTable USING(fDiscriminatorThresholdTableKEY) ";
+        $query0 .= " LEFT JOIN L1TriggerTable USING(fL1TriggerTableKEY) ";
+        $query0 .= " LEFT JOIN L2TriggerTable USING(fL2TriggerTableKEY) ";
+        $query0 .= " LEFT JOIN TriggerDelayTable USING(fTriggerDelayTableKEY) ";
+        $query0 .= " LEFT JOIN TestFlag USING(fTestFlagKEY) ";
+        $query0 .= " LEFT JOIN LightConditions USING(fLightConditionsKEY) ";
+        $query0 .= " LEFT JOIN ManuallyChanged USING(fManuallyChangedKEY) ";
+        $query0 .= " LEFT JOIN SequenceProcessStatus USING(fSequenceFirst,fTelescopeNumber) ";
+        $query0 .= " LEFT JOIN Calibration USING(fSequenceFirst,fTelescopeNumber) ";
+        $query0 .= " LEFT JOIN Star USING(fSequenceFirst,fTelescopeNumber) ";
 
 
@@ -171,6 +171,6 @@
     {
         $query1  = "SELECT fRunNumber, fCalibrationScriptName FROM RunData ";
-        $query1 .= " LEFT JOIN RunType ON RunData.fRunTypeKEY=RunType.fRunTypeKEY ";
-        $query1 .= " LEFT JOIN CalibrationScript ON RunData.fCalibrationScriptKEY=CalibrationScript.fCalibrationScriptKEY ";
+        $query1 .= " LEFT JOIN RunType USING(fRunTypeKEY) ";
+        $query1 .= " LEFT JOIN CalibrationScript USING(fCalibrationScriptKEY) ";
         $query1 .= " WHERE fSequenceFirst=" . $sequ . " AND fRunTypeName='" . $type . "'";
 
@@ -195,5 +195,5 @@
     {
         $query2  = "SELECT RunData.fRunNumber FROM RunData ";
-        $query2 .= " LEFT JOIN RunProcessStatus ON RunData.fRunNumber=RunProcessStatus.fRunNumber ";
+        $query2 .= " LEFT JOIN RunProcessStatus USING(fRunNumber,fTelescopeNumber,fFileNumber) ";
         $query2 .= " WHERE fSequenceFirst=" . $sequ . " AND IsNull(" . $column . ")";
 
Index: trunk/MagicSoft/Mars/datacenter/db/sequinfo-aio.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/sequinfo-aio.php	(revision 9089)
+++ trunk/MagicSoft/Mars/datacenter/db/sequinfo-aio.php	(revision 9105)
@@ -51,6 +51,7 @@
                     //$query0 .= " CONCAT('<A&ws;HREF=\"runinfo-aio.php?',  'fRunStart=On', '&amp;fZenithDistance=On', '&amp;fRunMin=', Sequences.fSequenceFirst, '&amp;fMeanTriggerRate=On', '&amp;fTest=On', '&amp;fRunTypeName=On', '&amp;fRunMax=', fSequenceLast, '&amp;fNumEvents=On', '&amp;fSourceName=On&amp;', 'fExcludedFDAKEY=1', '&amp;fSequenceFirst=On', '&amp;fRawFileAvail=On', '&amp;fCCFileAvail=On', '&amp;fCaCoFileAvail=On', '&amp;fNumResults=500\">', Sequences.fSequenceFirst, '</A>') ";
                     //new version using fSequenceNo
-                    $query0 .= " CONCAT('<A&ws;HREF=\"runinfo-aio.php?',  'fRunStart=On', '&amp;fZenithDistance=On', '&amp;fSequenceNo=', Sequences.fSequenceFirst, '&amp;fMeanTriggerRate=On', '&amp;fTest=On', '&amp;fRunTypeName=On', '&amp;fNumEvents=On', '&amp;fSourceName=On&amp;', 'fExcludedFDAKEY=1', '&amp;fSequenceFirst=On', '&amp;fRawFileAvail=On', '&amp;fCCFileAvail=On', '&amp;fCaCoFileAvail=On', '&amp;fNumResults=500\">', Sequences.fSequenceFirst, '</A>') ";
-                    $query0 .= " as " . $alias["fSequenceFirst"];
+                    $query0 .= " CONCAT('<A&ws;HREF=\"runinfo-aio.php?',  'fRunStart=On', '&amp;fZenithDistance=On', '&amp;fSequenceNo=', Sequences.fSequenceFirst, '&amp;fMeanTriggerRate=On', '&amp;fTest=On', '&amp;fRunTypeName=On', '&amp;fNumEvents=On', '&amp;fSourceName=On&amp;', 'fExcludedFDAKEY=1', '&amp;fSequenceFirst=On', '&amp;fRawFileAvail=On', '&amp;fCCFileAvail=On', '&amp;fCaCoFileAvail=On', '&amp;fNumResults=500\">', Sequences.fTelescopeNumber, ':', Sequences.fSequenceFirst, '</A>') ";
+//                    $query0 .= " as " . $alias["fSequenceFirst"];
+                    $query0 .= " as 'Tel:Sequ'";
                     if (!empty($_GET["fLinks"]))
                     {
@@ -76,7 +77,7 @@
         $query0 .= " FROM " . $fromtable;
 
-        $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
-        $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst ";
-        $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst ";
+        $query0 .= " LEFT JOIN SequenceProcessStatus USING(fSequenceFirst,fTelescopeNumber) ";
+        $query0 .= " LEFT JOIN Calibration USING(fSequenceFirst,fTelescopeNumber) ";
+        $query0 .= " LEFT JOIN Star USING(fSequenceFirst,fTelescopeNumber) ";
 
         foreach ($_GET as $key => $element)
@@ -87,5 +88,5 @@
         {
             if ($_GET["fSourceName"]!="On")
-                $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
+                $query0 .= " LEFT JOIN Source ON USING(fSourceKEY) ";
             $query0 .= " WHERE fTest='no'";
         }
@@ -319,9 +320,9 @@
         printf(" <P>\n");
 
-        PrintNumResPullDown();
 
         ini_set("mysql.trace_mode", "Off");
         ini_set("display_errors", "Off");
 
+        PrintNumResPullDown();
         PrintButtons("sequinfo-aio.php");
 
Index: trunk/MagicSoft/Mars/datacenter/db/sequinfo.php
===================================================================
--- trunk/MagicSoft/Mars/datacenter/db/sequinfo.php	(revision 9089)
+++ trunk/MagicSoft/Mars/datacenter/db/sequinfo.php	(revision 9105)
@@ -72,7 +72,7 @@
         $query0 .= " FROM " . $fromtable;
 
-        $query0 .= " LEFT JOIN SequenceProcessStatus ON Sequences.fSequenceFirst=SequenceProcessStatus.fSequenceFirst ";
-        $query0 .= " LEFT JOIN Calibration ON Sequences.fSequenceFirst=Calibration.fSequenceFirst ";
-        $query0 .= " LEFT JOIN Star ON Sequences.fSequenceFirst=Star.fSequenceFirst ";
+        $query0 .= " LEFT JOIN SequenceProcessStatus USING(fSequenceFirst,fTelescopeNumber) ";
+        $query0 .= " LEFT JOIN Calibration USING(fSequenceFirst,fTelescopeNumber) ";
+        $query0 .= " LEFT JOIN Star USING(fSequenceFirst,fTelescopeNumber) ";
 
 //        foreach ($_GET as $key => $element)
@@ -87,5 +87,5 @@
         {
             if ($_GET["fSourceName"]!="On")
-                $query0 .= " LEFT JOIN Source ON Sequences.fSourceKEY=Source.fSourceKEY ";
+                $query0 .= " LEFT JOIN Source ON USING(fSourceKEY) ";
             $query0 .= " WHERE fTest='no'";
         }
