DiH DiH - 1 year ago 91
SQL Question

Select from two tables without CommonElement

I want making select from two tables without any common element
I'm trying this code, but I get incorrect syntax near ','.

select top 1 inventory.name, customer.name
from inventory
where inventor.name='test' , customer where customer.name='test2'

Answer Source

It leads to cartesian product of two tables. (Cross Join). Try like this,

FROM inventory i
cross join customer c
WHERE i.NAME = 'test'
    AND c.NAME = 'test2'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download