AnsweredAssumed Answered

Nested SQL problem

Question asked by mark.geerdes on Aug 16, 2013
Latest reply on Sep 10, 2013 by mark.geerdes

Working on a nested SQL that I think should work, but is giving me wrong data:

 

 

ExecuteSQL (

 

"SELECT COUNT (DISTINCT pgc1."C1FD~Date")

FROM "PGC1~Field Days" pgc1

WHERE pgc1."C1FD~Date" BETWEEN ? AND ?

AND pgc1."C1FD~Primary" IN (

'Height Pole'

)

"

;

"" ; "" ;

ScheduledTimeOff::q1StartDate ; ScheduledTimeOff::q1EndDate ;

ScheduledTimeOff::id_EmployeeNumber )

 

gives me 42

 

ExecuteSQL (

"SELECT r.workingDaysSQLList

FROM "@Resources" r

" ;

"" ; "" )

 

gives me this:

 

Flatbed,Escort,Tillerman,Height Pole,Assem/Disassem,Route Survey,Push Truck,Pull Truck,Load/Unload,Care/Maintenance (In-Field),Off-Duty (In-Field),Repositioning/Travel,Mentoring,Supervision,Training (In-Field),Training (In-Classroom),Shop/Office Work

 

Note, Height Pole is 3rd in list

 

 

ExecuteSQL (

 

"SELECT COUNT (DISTINCT pgc1."C1FD~Date")

FROM "PGC1~Field Days" pgc1

WHERE pgc1."C1FD~Date" BETWEEN ? AND ?

AND pgc1."C1FD~Primary" IN (

SELECT r.workingDaysSQLList

FROM "@Resources" r

)

"

;

"" ; "" ;

ScheduledTimeOff::q1StartDate ; ScheduledTimeOff::q1EndDate ;

ScheduledTimeOff::id_EmployeeNumber )

 

gives me 0

 

what's wrong with my nested select? it should work.

Outcomes