main logo
Subject: Re: SQL problem
Author: Ruslan Zasukhin
Posted: 2002/08/29 12:23:09
 
View Entire Thread
New Search


on 8/29/02 17:35, Peter Lundb{ck at lunpet-9 .AT. student DO.T luth.se wrote:

Hi Peter,

> Is there possible to do this SQL select?
>
> SELECT * FROM Foretag_T, Kommun_T, Postort_T
> WHERE ForetagsID > 0
> AND ( LEFT (Kommun_T.Kommun,5) = 'stock' OR LEFT (Postort_T.Postort,5)
> = 'stock' )
>
>
> I never seems to get the OR inside the AND to work (it's always AND),
> in other words, i only get the post where Kommun and Postort is equal.
> Both fields are VarChar.

OR between different tables is not supported.
I always wonder -- what sense in such query?

As far as I see FULL OUTER JOIN can do the same work.

BTW, Peter, you use RDB links here ?
So why I do not see link conditions ?
Or you use ObjectPtr links ?

So try query as:

SELECT * FROM Foretag_T, Kommun_T, Postort_T
WHERE
// condition links
...
Kommun_T.ID *=* Postort_T
// match links
AND ForetagsID > 0
AND LEFT (Kommun_T.Kommun,5) = 'stock'
AND LEFT (Postort_T.Postort,5)

--
Best regards,
Ruslan Zasukhin [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan@paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list
send a letter to valentina-on .AT. lists DO.T macserve.net
-------------------------------------------------------------
 
©2002 Ruslan Zasukhin
<-- Prior Message New Search Next Message -->