[SQL] Related table question

Eric Forget forgete at cafederic.com
Thu Jan 15 14:20:01 CST 2004


> Table A  { a1 }
>   
>   1
>   2
>   3
> 
> 
> Table B { ptr ,b1 }
> 
>   1   1
>   1   2
>   1   3
>   2   1
>   2   2
> 
> Now when I do 
> 
>   select * 
>   from a, B
>   WHERE a.recID *= b.ptr
>   and b.b1 <> 1
> 
> 
> I get 
> 
>   a   ptr     b1
>   1   1       2
>   1   1       3
>   2   2       2  
>   3   null    null
> 
> 
> So query works right.

But this is not what I need. I need something like:

    select A.RecID 
    from A, B
    WHERE A.recID *= b.ptr
    and B.b1 <> 1

Then I get

        RecID
    1   1
    1   1
    2   2 
    3   3

Which is not what I want!

Eric

___________________________________________________________________

 Eric Forget                       Cafederic
 ForgetE at cafederic.com             <http://www.cafederic.com/>

 Fingerprint <86D5 38F5 E1FD 5D9C 71C3  BAA3 797E 70A4 6210 C684>




More information about the Valentina mailing list