R
rzaxl
select TrainDetails.ch_TrainDetailsID_pk, TrainDetails.ch_TrainDetailsID_fk,
TrainDetails.ch_CurrentYrNo, TrainDetails.ch_CurrentWkNo,
TrainDetails.ch_PlanYr,
TrainDetails.ch_WON_WkNo, TrainDetails.ch_PPSwrksiteTSR_ref,
TrainDetails.ch_NROL_PTO_ref,
TrainDetails.ch_VehicleType, TrainDetails.ch_TrainID,
TrainDetails.ch_RunDate from traindetails
GROUP BY TrainDetails.ch_TrainDetailsID_pk
having ch_currentWkNo > max(ch_currentWkNo) - 3;
Hi all I'm trying to output data out by comparing the current week no (which
is an integer type not a date type) with the maximum week no - 3, but it just
keeps on giving me an error. Basically if there are records in the db
numbered current week 1 - 10, I would like to grab the last 3 weeks which is
weeks 10 - 7, but as i said the above query does not run, would appriciate
and greatful some help
TrainDetails.ch_CurrentYrNo, TrainDetails.ch_CurrentWkNo,
TrainDetails.ch_PlanYr,
TrainDetails.ch_WON_WkNo, TrainDetails.ch_PPSwrksiteTSR_ref,
TrainDetails.ch_NROL_PTO_ref,
TrainDetails.ch_VehicleType, TrainDetails.ch_TrainID,
TrainDetails.ch_RunDate from traindetails
GROUP BY TrainDetails.ch_TrainDetailsID_pk
having ch_currentWkNo > max(ch_currentWkNo) - 3;
Hi all I'm trying to output data out by comparing the current week no (which
is an integer type not a date type) with the maximum week no - 3, but it just
keeps on giving me an error. Basically if there are records in the db
numbered current week 1 - 10, I would like to grab the last 3 weeks which is
weeks 10 - 7, but as i said the above query does not run, would appriciate
and greatful some help