Jump to content

[Resolved] Need Help with a Query


Dirty Butter

Recommended Posts

Is there any way to search a particular table to see all listings that have one term, but do NOT have another term in a given field?

I add any and all keywords I think customers might use in a search to our meta_data, and our search uses that data. It would be great when I think of something I want to add to the terms to find any that I haven't already included that new term.

Similarly, is there any way to find listings in the inventory table that have duplicate terms in the meta data?

Link to comment
Share on other sites

SELECT * FROM CubeCart_inventory 
WHERE `name` LIKE "%Book%" AND `name` NOT LIKE "%Volume%";

Selects where Book is somewhere in the column, but Volume is not somewhere in the column.

SELECT * FROM CubeCart_inventory
WHERE `name` LIKE '%Book%Book%';

Selects where Book is somewhere in the column, and then Book is also somewhere else later in the column.

Link to comment
Share on other sites

Well, I thought I did that, but I'll try again. lol

Must have had a typo - worked that time ! YOU ARE A LIFE SAVER!!

For my use it works better to use a comma after the term, since I'm trying to be sure it shows in the keywords - not as part of another word. That keeps caterpillars from being found when I'm actually looking for listings with cat that don't have cats in the keywords.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...