문제

Using openbravoPOS i got a mySQL database of all my producs tickets stock etc.

Products are in one table and the tickets are in another, so to make a query that get me all the products that are sold (and therefore are in ticketlines) are simple.

How do I make a query that gives me the products that are not i any ticketlines?

도움이 되었습니까?

해결책

You can use a LEFT OUTER JOIN for this:

select p.*
from products p
left outer join tickets t on p.ProductID = t.ProductID
where t.ProductID is null
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top