if (wherePrefix.equals(""))
if (wherePrefix.equals("")) {
  protected String formFirstCargoInstanceSql (FilterClauses filterClauses, int recentRun) {    String assetInstanceTable = DGPSPConstants.ASSET_INSTANCE_TABLE + "_" + recentRun;    String assetProtoTable = DGPSPConstants.ASSET_PROTOTYPE_TABLE + "_" + recentRun;    String cccDimTable = DGPSPConstants.CARGO_CAT_CODE_DIM_TABLE + "_" + recentRun;    String prototypeProto = assetProtoTable + "." + DGPSPConstants.COL_PROTOTYPEID;    String cccDimProto    = cccDimTable + "." + DGPSPConstants.COL_PROTOTYPEID;    String prototypeParentProto = assetProtoTable + "." + DGPSPConstants.COL_PARENT_PROTOTYPEID;    String prototypeNomen = assetProtoTable + "." + DGPSPConstants.COL_ALP_NOMENCLATURE;    String weight = DGPSPConstants.COL_WEIGHT;    String width  = DGPSPConstants.COL_WIDTH;    String height = DGPSPConstants.COL_HEIGHT;    String depth  = DGPSPConstants.COL_DEPTH;    String area   = DGPSPConstants.COL_AREA;    String volume = DGPSPConstants.COL_VOLUME;    String instanceID        = assetInstanceTable + "." + DGPSPConstants.COL_ASSETID;    String instanceProto     = assetInstanceTable + "." + DGPSPConstants.COL_PROTOTYPEID;    String instanceName      = assetInstanceTable + "." + DGPSPConstants.COL_NAME;    String instanceAggNumber = assetInstanceTable + "." + DGPSPConstants.COL_AGGREGATE;    String instanceOwner     = assetInstanceTable + "." + DGPSPConstants.COL_OWNER;    String orgNames = HierarchyConstants.ORGNAMES_TABLE_NAME + "_" + recentRun;    String orgNamesName = orgNames + "." + HierarchyConstants.COL_PRETTY_NAME;    String orgNamesOrg  = orgNames + "." + HierarchyConstants.COL_ORGID;    String assetItineraryTable = DGPSPConstants.ASSET_ITINERARY_TABLE + "_" + recentRun;    String itinLeg     = assetItineraryTable + "." + DGPSPConstants.COL_LEGID;    String itinID      = assetItineraryTable + "." + DGPSPConstants.COL_ASSETID;    String conveyedLegTable = DGPSPConstants.CONVEYED_LEG_TABLE + "_" + recentRun;    String cLegID      = conveyedLegTable + "." + DGPSPConstants.COL_LEGID;    String cLegStart   = conveyedLegTable + "." + DGPSPConstants.COL_STARTTIME;    String wherePrefix =       filterClauses.getUnitWhereSql (instanceOwner);    if (wherePrefix.equals(""))      wherePrefix = "\nwhere ";    else      wherePrefix += "\nand ";	    String sqlQuery =       "select distinct " + instanceID + ", " + instanceProto + ", " + instanceName + ", " + instanceAggNumber + ", " +      orgNamesName + ", " + prototypeNomen +", " + weight +", " + width +", " + height +", " + depth +", " + area +", " + volume +      "\nfrom "  + assetInstanceTable + ", " + assetProtoTable + ", " + orgNames + ", " + assetItineraryTable + ", " + cccDimTable +", "+      conveyedLegTable +       wherePrefix +      instanceProto + " = " + prototypeProto +      "\nand " + orgNamesOrg + " = " + instanceOwner +      "\nand " + instanceID + " = " + itinID +       "\nand " + itinLeg + " = " + cLegID +      "\nand " + cccDimProto + " = " + prototypeProto +      "\nand " + prototypeParentProto + " is null " +      "\norder by " + orgNamesName + ", " + ((sortByName) ? instanceName + ", " : "") + prototypeNomen + ", " + cLegStart;    if (debug)       System.out.println ("UnitQuery.formFirstCargoInstanceSql - \n" + sqlQuery);	    return sqlQuery;  }