Link to home
Start Free TrialLog in
Avatar of tsay
tsay

asked on

SQL Query

Hey,

in sql server I have two tables. First table is Items. It has two fields, ItemName and ItemCategory. I have a second table, called Categories. It has two fields, Category and AddToList. I want to write ONE query that selectes all Items where the AddToList boolean of the ItemCategory is set to 1. How can I do this? Redesigning the tables is not an option.

e.g.:
Item
====
ItemName: Ventureli
ItemCategory: BIKE
ItemName: Porsche
ItemCategory: CAR
ItemName: BMW
ItemCategory: CAR

ItemCategory
============
Category: BIKE
AddToList: 0
Category: CAR
AddToList: 1

Output of query should be Porsche and BMW.
ASKER CERTIFIED SOLUTION
Avatar of TimCottee
TimCottee
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tsay
tsay

ASKER

Perfect, tnx