Hello, I have a query that runs fine in an editor. When I paste the code into the "Toad View Editor" and run it via button in upper left corner, it runs fine. However, if I try to access the view using it in a query like select * from {{OrdersWithTotals}} it throws an error. The error I'm getting is: MySQL Database Error: Unknown column 'a42gejnkruhg0lpbdearktph7hfpju.BusDate' in 'on clause'. Here is the code. I'm kind of new to Toad, so maybe I'm over looking something. Thanks for any help you can give me. SELECT propvalue as `Store` ,tblorders.BusDate ,tblorders.OrderDate ,tblorders.OrderID ,tblorders.OrdStartTime ,tblorders.OrdSubmitTime ,tblorders.OrdTimePaid ,tblorders.OrdTimeBumpedKDS ,tblorders.OrdDvrOutTime ,tblorders.OrdDvrInTime ,tblorders.OrdApproxDelTime ,tblorders.OrdServiceType ,tblorders.OrdEmp ,tblorders.OrdEmpName ,tblorders.OrdPhoneID ,tblorders.OrdPhone ,tblorders.OrdCustID ,tblorders.OrdCustName ,tblorders.OrdCustAddr1 ,tblorders.OrdCustAddr2 ,tblorders.OrdCustCity ,tblorders.OrdCustSt ,tblorders.OrdCustZip ,tblorders.OrdDriver ,tblorders.OrdDriverName ,tblorders.OrdVoidReason ,tblorders.OrdVoidReasonText ,tblorders.OrdOnlineOrderID ,tblorders.OrdRewardsNumber ,tblorders.OrdRewardsPoints ,tblorders.OrdEmailAddress ,tblorders.DeferredOrderID ,tblorders.OrdDelayedPrintTime ,tblservicetypes.ServiceTypeName ,date_format( DATE(tblorders.OrderDate + INTERVAL (6 - WEEKDAY(tblorders.OrderDate)) DAY) ,'%m/%d') as `WE Date` ,concat( if( tblorders.OrdOnlineOrderID is not null ,'WEB - ' ,'') ,tblservicetypes.servicetypename) as `Service Type` ,totals.ototTotal as `Total With DelChg Amount and Tax` ,totals.ototSubTotal as `Total Before DelChg and Tax` ,totals.ototDelChg as `Delivery Charge` ,totals.OtotTotal - (totals.OtotSubTotal + totals.OtotDelChg) as `Sales Tax` FROM MYSYSposhistory.tblorders tblorders INNER JOIN MYSYSpos.tblservicetypes tblservicetypes ON (tblorders.OrdServiceType = tblservicetypes.ServiceTypeID) INNER JOIN tblordtotals totals on tblorders.OrderID = totals.OtotOrder and totals.BusDate = tblorders.BusDate join (select propvalue from MYSYSpos.tblconfig where propname = 'StoreName') as configr
↧