此查询会返回如下结果:select distinct date from dwh.product_count
April, 2013
March, 2013
February, 2013
January, 2013
我想追加许多结果^ ^会带回此查询的结果:
select distinct p_id dwh.members a
5
7
8
...etc
所以我的结果看起来像这样:
5 April, 2013
5 March, 2013
5 February, 2013
5 January, 2013
7 April, 2013
7 March, 2013
7 February, 2013
7 January, 2013
etc....
什么类型的查询会带来这些结果?
答案 0 :(得分:2)
select id, dt
from
(select distinct p_id as id from dwh.members) s
cross join
(select distinct date as dt from dwh.product_count) t
答案 1 :(得分:1)
select id, dt from
( select distinct p_id as id from dwh.members )
.( select distinct date as dt from dwh.product_count )