Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    54
    Thanks
    12
    Thanked 0 Times in 0 Posts

    Search based on multiple fields

    I'm looking to modify a search query I have that searches on a single field, but returns results from all fields. What I want to do, since duplicates exist under certain conditions, is eliminate the duplicates from displaying on the wildcard search.

    Fields are Display, Link, Category, UniqueID

    The wildcard is searching on the Link field using %domain% to pull in all data.
    I'm using PHP to generate a URL. The duplicates can exist as the same URL can be entered with multiple Category field entries.

    Right now my query looks like this:
    Code:
    SELECT * FROM `mytable` WHERE `Link` LIKE '%domain%'");
    I'm thinking that I can do something with either the Category or UniqueID fields, but the syntax is not coming to me when I think of how I should be writing it.

  • #2
    New Coder
    Join Date
    Dec 2012
    Posts
    54
    Thanks
    12
    Thanked 0 Times in 0 Posts
    I may have answered my own question, but I'll leave it up in case I am way off base.

    If I use a GROUP BY and group it by Link, then it will only display each link in the resulting php output 1 time, thus eliminating my duplicates as only the URL shows in the output, not the Category or UniqueID fields.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •