• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 301
  • Last Modified:

select query troubles

I have a select query which works fine.

but I want toe exclude a result where catid = 126 How do I do this.

SELECT * FROM categories WHERE Parentid = 0 AND ORDER by catname
Cheryl Lander
Cheryl Lander
  • 2
1 Solution
Kevin CrossChief Technology OfficerCommented:
You just add that to the WHERE clause like this:

FROM Categories
WHERE ParentId = 0 AND CatId <> 126
Cornelia YoderArtistCommented:
mwvisa1 is correct, except you need to watch capitalization on the table name:

SELECT * FROM categories WHERE Parentid = 0 AND catid!=126 ORDER by catname
Kevin CrossChief Technology OfficerCommented:
Depending on what database platform, the not equal may be != so the query would be:

CatId != 126.

If I am misunderstanding the exclude portion of the question you would just change this to be:

CatId = 126
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now