开发者

Making a mySQL-query to get products that have not ben sold?

开发者 https://www.devze.com 2023-01-01 04:19 出处:网络
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开发者_StackOverflow query that get me all the pro

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开发者_StackOverflow 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
0

精彩评论

暂无评论...
验证码 换一张
取 消