stephane michaud
2011-07-01 09:55:47 UTC
Hello,
i have an issue with a cross join query.
Here is the query i run with winsql, and it's working:
select date_v.cal_dt ,count(location_v.cmc_str_nbr)
from date_v
cross join location_v
left join order_v
on date_v.cal_dt = order_v.cal_dt and order_v.cmc_chn_str_nbr = location_v.cmc_chn_str_nbr
where (date_v.cal_dt between now()-8 and now() -1)
and order_v.cmc_chn_str_nbr is null
and location_v.str_live_dt is not null and location_v.str_deinstall_dt is null
and location_v.str_typ_cd in (0) and location_v.str_rdir_flg = 'Y'
and location_v.cmc_chn_nbr in (1,2,22,24,65,86,87)
group by date_v.cal_dt
order by date_v.cal_dt
when i put it on reporting services, it converts me like below and it's not weorking
SELECT admin.date_v.cal_dt, admin.location_v.cmc_chn_str_nbr
FROM admin.location_v, { oj admin.date_v LEFT OUTER JOIN
admin.order_v ON admin.date_v.cal_dt = admin.order_v.cal_dt AND admin.order_v.cmc_chn_str_nbr = admin.location_v.cmc_chn_str_nbr }
WHERE (admin.date_v.cal_dt BETWEEN NOW() - 8 AND NOW() - 1) AND (admin.order_v.cmc_chn_str_nbr IS NULL) AND (admin.location_v.str_live_dt IS NOT NULL) AND
(admin.location_v.str_deinstall_dt IS NULL) AND (admin.location_v.str_typ_cd IN (0)) AND (admin.location_v.str_rdir_flg = 'Y') AND
(admin.location_v.cmc_chn_nbr IN (1, 2, 22, 24, 65, 86, 87))
ORDER BY admin.date_v.cal_dt
it give me this error:
ERROR [HY000] ERROR: Table name "pncfre1r.admin.location_v" not listed in the FROM-clause
Do you know how i could use the cross join query?
thanks a lot for your help
i have an issue with a cross join query.
Here is the query i run with winsql, and it's working:
select date_v.cal_dt ,count(location_v.cmc_str_nbr)
from date_v
cross join location_v
left join order_v
on date_v.cal_dt = order_v.cal_dt and order_v.cmc_chn_str_nbr = location_v.cmc_chn_str_nbr
where (date_v.cal_dt between now()-8 and now() -1)
and order_v.cmc_chn_str_nbr is null
and location_v.str_live_dt is not null and location_v.str_deinstall_dt is null
and location_v.str_typ_cd in (0) and location_v.str_rdir_flg = 'Y'
and location_v.cmc_chn_nbr in (1,2,22,24,65,86,87)
group by date_v.cal_dt
order by date_v.cal_dt
when i put it on reporting services, it converts me like below and it's not weorking
SELECT admin.date_v.cal_dt, admin.location_v.cmc_chn_str_nbr
FROM admin.location_v, { oj admin.date_v LEFT OUTER JOIN
admin.order_v ON admin.date_v.cal_dt = admin.order_v.cal_dt AND admin.order_v.cmc_chn_str_nbr = admin.location_v.cmc_chn_str_nbr }
WHERE (admin.date_v.cal_dt BETWEEN NOW() - 8 AND NOW() - 1) AND (admin.order_v.cmc_chn_str_nbr IS NULL) AND (admin.location_v.str_live_dt IS NOT NULL) AND
(admin.location_v.str_deinstall_dt IS NULL) AND (admin.location_v.str_typ_cd IN (0)) AND (admin.location_v.str_rdir_flg = 'Y') AND
(admin.location_v.cmc_chn_nbr IN (1, 2, 22, 24, 65, 86, 87))
ORDER BY admin.date_v.cal_dt
it give me this error:
ERROR [HY000] ERROR: Table name "pncfre1r.admin.location_v" not listed in the FROM-clause
Do you know how i could use the cross join query?
thanks a lot for your help