Skip to content

Instantly share code, notes, and snippets.

@simonmcc
Created March 1, 2010 13:28
Show Gist options
  • Save simonmcc/318369 to your computer and use it in GitHub Desktop.
Save simonmcc/318369 to your computer and use it in GitHub Desktop.
*************************** 4. row ***************************
Id: 4935352
User: all_select
Host: t-10.estara.com:52592
db: NULL
Command: Query
Time: 10428
State: Sorting result
Info: SELECT logtable.SIPCallID, CallID, logtable.TimeRinging, logtable.TimeConnected, logtable.TimeTerminated, ConfServerIP, SIPCallIDAgent, logtable.TimeInitiated, logtable.GatewayIP, logtable.GatewayIPAgent, logtable.TimeConnected, UNIX_TIMESTAMP(logtable.TimeTerminated)-UNIX_TIMESTAMP(logtable.TimeConnected), logtable.var5, UserTelephoneNumber, logtable.var1, logtable.var2, logtable.var3, logtable.var4, InboundTelephoneNumber, logtable.TelephoneNumber, 'not applicable' AS `CallerIP` , 'not applicable' AS `Referrer` , Population, AvgTravelTimeToWork, MedianHouseholdIncome, PerCapitaIncome, MedianEarnings, MedianContractRent, MedianRentAsked, MedianGrossRent, MedianPriceAsked, MedianRealEstateTaxes, Households, OwnerHouseholds, RenterHouseholds, NDISCache.Src, NDISCache.phone, NDISCache.LastName, NDISCache.CNAM, NDISCache.FirstName, NDISCache.StreetAddress, NDISCache.City, NDISCache.State, NDISCache.Zip, NDISCache.Zip AS NDISZip, NDISCache.alreadytriedpremium, cen.*, callerinfotable.callerinfo, UserTelephoneNumber
FROM reportingarchive.CallTransferLogs logtable LEFT JOIN Reference.PhoneData
ON NPA = IF('1'=SUBSTRING(UserTelephoneNumber, 1,1), SUBSTRING(UserTelephoneNumber, 2, 3), 'xxx')
AND NXX = SUBSTRING(UserTelephoneNumber, 5, 3) LEFT JOIN Reference.NDISCache
ON NDISCache.phone = UserTelephoneNumber LEFT JOIN Reference.Census cen
ON cen.Zip = PhoneData.zip LEFT JOIN webcare.InboundTransfer callerinfotable
ON callerinfotable.upbid = logtable.LinkID LEFT JOIN webcare.Organizations
ON Organizations.uoid = logtable.ClientID LEFT JOIN MCURecordings.MCURecordings
ON CallID = logtable.SIPCallID
AND isdeleted = '0' WHERE logtable.TimeInitiated BETWEEN '2010-02-01 00:00:00' AND '2010-02-28 23:59:59'
AND logtable.ClientID = '200106293226' AND ( logtable.var2 LIKE '29361975' ) AND TimeUserConnected >= logtable.TimeInitiated AND (logtable.TimeConnected != '0000-00-00 00:00:00' AND logtable.TimeTerminated >= logtable.TimeConnected) ORDER BY '1', logtable.TimeConnected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment