Tema: Re: SQL klausimas
Autorius: zZz
Data: 2011-05-20 14:18:00
select id1, id2 from lenta where id1 < id2
union
select id2 , id1 from lenta where id2 < id1


"NicMC" <jzs@freemail.lt> wrote in message news:ir5gs4$jdk$1@trimpas.omnitel.net...
> Sveiki,
> 
> Lenta:
> +-------------------+
> | ID1 | ID2 | Value |
> +-------------------+
> |  A  |  B  |  X    |
> +-------------------+
> |  B  |  A  |  X    |
> +-------------------+
> |  C  |  B  |  X    |
> +-------------------+
> |  B  |  C  |  Y    |
> +-------------------+
> 
> 
> Reikia išrinkti unukalius įrašus, unikaliu neklaikant ID1 ir ID2 laukų 
> apkeitimo vietomis, t.y. A | B = B | A
> 
> +-------------------+
> | ID1 | ID2 | Value |
> +-------------------+
> |  A  |  B  |  X    |
> +-------------------+
> |  C  |  B  |  X    |
> +-------------------+
> |  B  |  C  |  Y    |
> +-------------------+
> 
> Kaip suselektint?