We help IT Professionals succeed at work.

Filter Mysql query

maximus81
maximus81 asked
on
What I am trying to do is run a mysql query but I then want to filter some stuff out. Here is the query I am running and the stuff I want to filter out.

select * from software where software_uuid = '4C4C4544-0059-3310-804B-B9C04F313931' order by software_name

I want to filter out like Hotfix, Security Update.

How do i do this in one query? Thanks
Comment
Watch Question

Greg AlexanderLead Developer

Commented:
select * from software where software_uuid = '4C4C4544-0059-3310-804B-B9C04F313931' order by software_name WHERE field_name != 'something here' AND another_field NOT LIKE '%wild cards on the end%'
Greg AlexanderLead Developer

Commented:
Whoops. use this instead:

select * from software where software_uuid = '4C4C4544-0059-3310-804B-B9C04F313931' WHERE field_name != 'something here' AND another_field NOT LIKE '%wild cards on the end%' order by software_name 

Open in new window

Author

Commented:
select * from software where software_uuid = '4C4C4544-0059-3310-804B-B9C04F313931' WHERE software_name != 'Hotfix' AND software_name NOT LIKE '%Update%' order by software_name

I get an syntax error when I try to run this.
Lead Developer
Commented:
Try this:

select * from software where software_uuid = '4C4C4544-0059-3310-804B-B9C04F313931' AND software_name != 'Hotfix' AND software_name NOT LIKE '%Update%' order by software_name

Author

Commented:
That works, thank you, I do have one question is != the same as NOT LIKE? I am asking because I want everything that has Hotfix in it to be filtered out.

Author

Commented:
You saved me a lot of time. Thank you

Explore More ContentExplore courses, solutions, and other research materials related to this topic.