Skip to main content
Question

CrossJoin with InStr function won't bring in value from column

  • July 20, 2021
  • 2 replies
  • 5 views

slc1axj
Forum|alt.badge.img+1

The code below runs fine and brings in the correct Provider Lookup; however, if I change a."Provider Lookup" to a."Provider", it does not bring back the Provider but plugs in the "N". I can't figure out what's happening... I have confirmed that the HCPC in the WFMGMT_PRD.map_auto_provider table and zip code match to the same instance within the wfmgmt_prd.open_report_hourly

select o."zip code",
MAX(CASE WHEN INSTR(o.'provider hcpc/revenue code', a.HCPC) >= 1 and cast(cast(cast(o.'zip code' as float) as int) as varchar)= a.zip THEN a."Provider Lookup" ELSE 'N' END) "Auto-Provider"
from wfmgmt_prd.open_report_hourly o
CROSS JOIN WFMGMT_PRD.map_auto_provider a
where "Report Interval" >= (select max("Report Interval") from wfmgmt_prd.open_report_hourly)
and o."queue type" = 'Provider Staffing'
and o."intake id"='10969508'
group by o."zip code",o."provider hcpc/revenue code"

2 replies

slc1axj
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • July 22, 2021

I've attached an Excel document showing the 2 tables queried separately (2 separate tabs) - then the crossjoin that will not bring in the provider name (3rd tab).


slc1axj
Forum|alt.badge.img+1
  • Author
  • Participating Frequently
  • July 28, 2021

Vertica Analytic Database v10.1.1-1

We all got together to try to figure this out and we think the issue is Vertica is not bringing back all the rows to match as it must have a limit.