On 3/16/2011 2:21 PM, Ralf Jantschek wrote:
> ok I give it a try ( I just recognized, I made a mistake with the status,
> this is the correct version).
>
> Table 1 t1.id, t1.name, t1.status:
> 1 "Program 1" 1
> 2 "Program 1" 0
>
> Table 2 t1.id, t3.id:
> 1 1
> 1 2
> 2 3
> 2 4
>
> Table 3 t3.id, t3.key, t3.value
> 1 "Key 1" "Value 1"
> 2 "Key 2" "Value 2"
> 3 "Key 1" "Value 3"
> 4 "Key 2" "Value 2"
>
> What do I have to do, to find out that "Key 1" got a new value?
select * from
t1 t1s0 join t2s0 using ("t1.id") join t3s0 using ("t3.id"),
t1 t1s1 join t2s1 using ("t1.id") join t3s1 using ("t3.id")
where
t1s0."t1.name" = t1s1."t1.name" and t1s0."t1.status" = 0 and
t1s0."t1.status" = 1 and
t3s0."t3.key" = t3s1."t3.key" and t3s0."t3.value" != t3s1."t3.value";
--
Igor Tandetnik
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users