All pastes #2102572 Raw Edit

Someone

public text v1 · immutable
#2102572 ·published 2012-01-12 11:43 UTC
rendered paste body
explain select *,
       case
         when transactio44_1_.transactionDocumentID is not null then
          1
         when transactio44_2_.transactionDocumentID is not null then
          2
         when transactio44_3_.transactionDocumentID is not null then
          3
         when transactio44_.transactionDocumentID is not null then
          0
       end as clazz_42_
  from storeevent this_
  left outer join financialevent this_1_ on this_.eventID = this_1_.eventID
  left outer join drawerloandetailin this_2_ on this_.eventID =
                                                this_2_.eventID
  left outer join drawerloandetailout this_3_ on this_.eventID =
                                                 this_3_.eventID
  left outer join driveoffdetail this_4_ on this_.eventID = this_4_.eventID
  left outer join fuelentry this_5_ on this_.eventID = this_5_.eventID
  left outer join FuelRegularization this_6_ on this_.eventID =
                                                this_6_.eventID
  left outer join fuelreturn this_7_ on this_.eventID = this_7_.eventID
  left outer join payindetail this_8_ on this_.eventID = this_8_.eventID
  left outer join payoutdetail this_9_ on this_.eventID = this_9_.eventID
  left outer join pumptestdetail this_10_ on this_.eventID =
                                             this_10_.eventID
  left outer join safedropdetail this_11_ on this_.eventID =
                                             this_11_.eventID
  left outer join safeloandetail this_12_ on this_.eventID =
                                             this_12_.eventID
  left outer join transactionalevent this_13_ on this_.eventID =
                                                 this_13_.eventID
 inner join gasstation gasstation2_ on this_.gasStation_gasStationID =
                                       gasstation2_.gasStationID
  left outer join country country3_ on gasstation2_.country_id =
                                       country3_.id
  left outer join TaxPolicy taxpolicy4_ on country3_.taxpolicy_id =
                                           taxpolicy4_.id
  left outer join Region region5_ on gasstation2_.region_id = region5_.id
  left outer join country country6_ on region5_.country_id = country6_.id
  left outer join State state7_ on gasstation2_.state_id = state7_.id
  left outer join Region region8_ on state7_.region_id = region8_.id
  left outer join avaloncustomercompany avaloncust9_ on gasstation2_.acc_id =
                                                        avaloncust9_.avalonCustomerCompanyID
  left outer join financialdetailtype financiald10_ on avaloncust9_.financialdetailtypeforregs_id =
                                                       financiald10_.financialDetailTypeID
  left outer join UnitOfMeasure unitofmeas11_ on avaloncust9_.consolidationUnitOfVolume_id =
                                                 unitofmeas11_.id
  left outer join UnitOfMeasure unitofmeas12_ on avaloncust9_.defaultUnitOfMeasure_id =
                                                 unitofmeas12_.id
  left outer join TaxPolicy taxpolicy13_ on avaloncust9_.taxPolicy_id =
                                            taxpolicy13_.id
  left outer join financialdetailtype financiald14_ on gasstation2_.driveOffFinancialDetailType_id =
                                                       financiald14_.financialDetailTypeID
  left outer join financialdetailtype financiald15_ on gasstation2_.safeDropFinancialDetailType_id =
                                                       financiald15_.financialDetailTypeID
  left outer join financialdetailtype financiald16_ on gasstation2_.safeLoanFinancialDetailType_id =
                                                       financiald16_.financialDetailTypeID
 inner join journalClose journalclo17_ on this_.journalClose_journalCloseID =
                                          journalclo17_.journalCloseID
  left outer join register register18_ on this_.register_registerID =
                                          register18_.registerID
  left outer join financialdetailtype financiald19_ on this_1_.financialDetailType_id =
                                                       financiald19_.financialDetailTypeID
  left outer join drawerloandetailin drawerloan20_ on this_3_.drawerloandetailin_id =
                                                      drawerloan20_.eventID
  left outer join financialevent drawerloan20_1_ on drawerloan20_.eventID =
                                                    drawerloan20_1_.eventID
  left outer join storeevent drawerloan20_2_ on drawerloan20_.eventID =
                                                drawerloan20_2_.eventID
  left outer join Hose hose21_ on this_4_.hose_hoseID = hose21_.hoseID
  left outer join productdescription fuelgrade22_ on hose21_.fuelgrade_soldableid =
                                                     fuelgrade22_.id
  left outer join productcategory productcat23_ on fuelgrade22_.productCategory_id =
                                                   productcat23_.id
  left outer join catalog catalog24_ on productcat23_.catalog_id =
                                        catalog24_.id
  left outer join avaloncustomercompany avaloncust25_ on catalog24_.acc_id =
                                                         avaloncust25_.avalonCustomerCompanyID
  left outer join AvalonCustomer avaloncust26_ on avaloncust25_.avalonCustomer_id =
                                                  avaloncust26_.avalonCustomerID
  left outer join productsubfamily productsub27_ on productcat23_.productSubfamily_id =
                                                    productsub27_.id
  left outer join catalog catalog28_ on productsub27_.catalog_id =
                                        catalog28_.id
  left outer join productfamily productfam29_ on productsub27_.productFamily_id =
                                                 productfam29_.id
  left outer join catalog catalog30_ on productfam29_.catalog_id =
                                        catalog30_.id
  left outer join specialdayscalendar specialday31_ on productfam29_.specialDaysCalendar_id =
                                                       specialday31_.id
  left outer join avaloncustomercompany avaloncust32_ on specialday31_.acc_id =
                                                         avaloncust32_.avalonCustomerCompanyID
  left outer join specialdayscalendar specialday33_ on productsub27_.specialDaysCalendar_id =
                                                       specialday33_.id
  left outer join specialdayscalendar specialday34_ on productcat23_.specialDaysCalendar_id =
                                                       specialday34_.id
  left outer join UnitOfMeasure unitofmeas35_ on fuelgrade22_.purchasesUnitOfMeasure_id =
                                                 unitofmeas35_.id
  left outer join UnitOfMeasure unitofmeas36_ on fuelgrade22_.salesUnitOfMeasure_id =
                                                 unitofmeas36_.id
  left outer join UnitOfMeasure unitofmeas37_ on fuelgrade22_.storageUnitOfMeasure_id =
                                                 unitofmeas37_.id
  left outer join catalog catalog38_ on fuelgrade22_.catalog_id =
                                        catalog38_.id
  left outer join merchandisecategory merchandis39_ on fuelgrade22_.merchandisecategory_id =
                                                       merchandis39_.merchandiseCategoryID
  left outer join fuelproduct fuelproduc40_ on fuelgrade22_.fuelproduct_fuelproductid =
                                               fuelproduc40_.fuelProductID
  left outer join positions position41_ on hose21_.position_positionID =
                                           position41_.positionID
  left outer join UnitOfMeasure unitofmeas42_ on hose21_.salesUnitOfVolume_id =
                                                 unitofmeas42_.id
  left outer join transactionalevent transactio43_ on this_4_.transactionalEvent_eventID =
                                                      transactio43_.eventID
  left outer join storeevent transactio43_1_ on transactio43_.eventID =
                                                transactio43_1_.eventID
  left outer join transactiondocument transactio44_ on transactio43_.eventID =
                                                       transactio44_.transactionalEvent_eventID
  left outer join DeliveryNote transactio44_1_ on transactio44_.transactionDocumentID =
                                                  transactio44_1_.transactionDocumentID
  left outer join invoice transactio44_2_ on transactio44_.transactionDocumentID =
                                             transactio44_2_.transactionDocumentID
  left outer join ticket transactio44_3_ on transactio44_.transactionDocumentID =
                                            transactio44_3_.transactionDocumentID
  left outer join fuelproduct fuelproduc45_ on this_5_.fuelProduct_fuelProductID =
                                               fuelproduc45_.fuelProductID
 where this_.cashier_employeeid = 5074
   and this_.gasStation_gasStationID = 5057
 order by this_.eventStartDate desc limit 1;