sql - Inner join query -
please go thourgh attached image descirbed scenario:
i want sql join query.
have @ like
select * orders o exists ( select 1 orderbooks ob inner join books b on ob.bookid = b.bookid o.orderid = ob.orderid , b.isbook = @isbook )
the query return orders based on given criteria.
so, is, when @isbook = 1
return orders there exists 1 or more entries linked order books. , if @isbook = 0
return orders there exists 1 or more entries linked order not books.
Comments
Post a Comment