ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zoran Avtarovski <zo...@sparecreative.com>
Subject Re: OT: Left Join Question
Date Wed, 14 Dec 2005 10:55:23 GMT
Sorry Vic,

I'm not sure I understand.

I tried
SELECT list_item.value, list_item.label, m2m.trans_id
FROM list_item, m2m
WHERE list_item.list_type IN (?)
UNION
SELECT list_item.value, list_item.label, m2m.trans_id
FROM list_item
LEFT JOIN m2m ON
(m2m.response_id = list_item.value AND m2m.trans_id = ?)

But I  get duplicate values and all list types.

What I need is to retrieve a left join of all list items of a particular
type with the relevant m2m values, if present and null if not.

Zoran

> 
>> 
>> I now have the need to store multiple list types in the list_item table
> 
> where x in (a, b, c)
> 
> 
>   and
>> have to add a list_type column to the list_item table.
>> 
> 
> select ....
> union
> select ....
> 
> .V
> 



Mime
View raw message