If table_A has mutiple rows (say like)

        column1 column2
        1               B
        2               H
        3               R
        4               Q
        5               V

And table_B has

        column1 column2
                        B
                        R
        3               H
                        Q
        5               V


If I do
        
        select column1 from table_A

I get
        1
        2
        3
        4
        5

But if I do
        SELECT * FROM TABLE_B where column1 = ( select column1 from table_A )

I get an empty set (which is good)

If I do
        update TABLE_B set column1 = ( select column1 from table_A )

I expexct to get an error since "select column1 from table_a" is multivalued But I dont. The update succeeds as though I wrote "update TABLE_B set column1 = ( select column1 from table_A returning 1 row )" or something
Table_B is updated with the first result from the subselect.

Table_B now has

        column1 column2
        1               B
        1               R
        1               H
        1               Q
        1               V

And now if I do
        SELECT * FROM TABLE_B where column1 = ( select column1 from table_A )

I get all rows in table_B which again seems wrong since the subselect IS multivalued

It would make sense that the select worked if I wrote
        SELECT * FROM TABLE_B where column1 IN ( select column1 from table_A )

Any idea?

---
Marco Bambini


Reply via email to