0

I have the following query

select
v.id,
c.image_type_id,
vp.x, 
vp.y,
vp.z
FROM
v,
vp,
c,
WHERE v.id = vp.id 
  AND v.id = c.id

I need the v.id to be unique in each column (only one entry for each v.id). Some of the ids are returning multiple rows. What's the best way to do it?

P.S The rows of the duplicate ids are different

4

1 回答 1

0

您可以尝试使用“分组依据”注意,您将丢失其他列中的一些值

select
v.id,
max(c.image_type_id),
max(vp.x), 
max(vp.y),
max(vp.z)
FROM
v,
vp,
c,
WHERE v.id = vp.id 
  AND v.id = c.id
group by v.id;
于 2013-09-13T16:51:33.383 回答