GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

make ranking on search result

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • make ranking on search result

    i hv a product table chemicals(prodname,prodcat,proddesc)

    my query is


    SELECT prodname FROM bw_product WHERE

    prodname like '%sodium chloride%'

    OR
    prodcateg like '%sodium chloride%'

    OR
    proddesc like '%sodium chloride%'

    order by prodname



    "sodium chloride" is searched ,
    I am getting a very large number of results and the product "sodium chloride" is nowhere near the top.
    The search needs to be configured so that exact (or nearly exact) "prodname" appear at the top,exact (or nearly exact) "prodcateg" appear at the next level and the lowest "ranked" results (ones at bottom) should be ones that had a search hit in the "proddesc" field.

    how can i possible these ? pls give the correct query

  • #2
    Maybe try this:


    SELECT prodname,1 as id FROM bw_product WHERE prodname like '%sodium chloride%'

    UNION
    SELECT prodcateg,2 as id FROM bw_product WHERE like '%sodium chloride%'

    UNION
    SELECT proddesc,3 as id FROM bw_product WHERE like '%sodium chloride%'

    order by id

    Comment


    • #3
      thanks u its working

      Comment

      Working...
      X