Armin Haaf wrote:
> 
> A example:
> 
> create table foo (
>         id     smallint,
>         pos    smallint,
>         txt  varchar(2048)
> );
> 
> 
> Both selects didn't work:
> 
> select a.id
>    from foo a, foo b, foo c, foo d
>   where a.id = b.id
>     and b.id = c.id
>     and c.id = d.id
>     and a.pos = 1
>     and b.pos = 2
>     and c.pos = 3
>     and d.pos = 4
>     and (
>            a.txt = 'foo'
>         or b.txt = 'bar'
>         or c.txt = 'baz'
>         or d.txt = 'biz'
>     );
> 
> 
> 
> select a.id
>    from foo a, foo b, foo c, foo d
>   where a.id = b.id
>     and b.id = c.id
>     and c.id = d.id
>     and (
>          (a.pos = 1 and a.txt = 'foo')
>       or (b.pos = 2 and b.txt = 'bar')
>       or (c.pos = 3 and c.txt = 'baz')
>       or (d.pos = 4 and d.txt = 'biz')
>     )
>    ;
> 
> 
> Result of this selects are
> 
> "DBTech SQL: [-2000] (at 8343) Row too long"
> 
> 
> 
> It seems sapdb creates a result table with the columns of each from 
> table concatenated. Is this normal behaviour? If this is normal 
> behaviour, is it possible to do "large" self joins on a table 
> with sapdb?
> 

Unfortunately you are right, sapdb creates such a provisional result to
handle 
the "or" qualification.
This is valid for every type of join not only self joins.
May be I'm wrong but I think your example will work without join.
For example

 select id
    from foo 
   where  (pos = 1 and txt = 'foo')
       or (pos = 2 and txt = 'bar')
       or (pos = 3 and txt = 'baz')
       or (pos = 4 and txt = 'biz')
     );

should give the result.

Regards,
Holger

SAP Labs Berlin
_______________________________________________
sapdb.general mailing list
[EMAIL PROTECTED]
http://listserv.sap.com/mailman/listinfo/sapdb.general

Reply via email to