从两个表中提取数据

时间:2013-10-13 20:48:31

标签: join outer-join

我有两个表“CAR” - 字段是 - (car_id,name),第二个表“CARSFORSALE”包含待售汽车(id,car_id,....) 如何在一个查询中为每个car_id从“CARSFORSALE”表中获取10行

这意味着如果我有7个car_id,我的结果将是< = 70

1 个答案:

答案 0 :(得分:0)

select 1,car_id
union all
select 2,car_id
union all
select 3,car_id
union all
select 4,car_id
union all
select 5,car_id
union all
select 6,car_id
union all
select 7,car_id
union all
select 8,car_id
union all
select 9,car_id
union all
select 10,car_id