0

Trying to find all these that are not in warehouse number 3 and unit price less than 100. Whats wrong with my code?

select part_number,
           part_description,
           Units_on_Hand,
           Unit_price,
           Warehouse_number
from part
where unit_price >= 100
and not in warehouse_number = 3;
1
  • Hi Clay - you might want to read How to Ask and minimal reproducible example - specifically for this question you could probably have got a better response by including whatever error you're seeing, and referring to that error in the question title (we can tell it's sql/access from the tags, even on the questions page). Commented Dec 17, 2016 at 20:41

2 Answers 2

2

The problem is not in. You can do:

where unit_price >= 100 and
      not (warehouse_number = 3);

Or:

where unit_price >= 100 and
      warehouse_number not in (3);

Or:

where unit_price >= 100 and
      warehouse_number <> 3;

These are all equivalent. The last would be the more "typical" way to write this for 1 warehouse. The second would be the more typical way if there was more than one warehouse.

Sign up to request clarification or add additional context in comments.

7 Comments

Thank you i tried those and its still giving me an error message.
select part_number, part_description, Units_on_Hand, Unit_price, Warehouse_number from part where unit_price >= 100 and warehouse_number not in (3);
data type mismatch in criteria expression
What is the data type of warehouse_number?
@Clay . . . That would suggest that either unit_price or warehouse_number are not the numbers they appear to be.
|
-1
SELECT part_number, part_description, Units_on_Hand, Unit_price, Warehouse_number 
FROM part 
Where unit_price >= 100 AND warehouse_number NOT IN (3);

2 Comments

still receiving error message with that to and i dont get why. I appreciate the effort though thank you
Thank you sorry i had a simple data type mismatch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.