Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6580415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:01:36+00:00 2026-05-25T16:01:36+00:00

I have This type of query when I execute it it return duplicate row

  • 0

I have This type of query when I execute it it return duplicate row in table,,
what’s the problem with this ?????

Declare @Keyword AS NVARCHAR(MAX) 
Set @Keyword = 'scale'


select DISTINCT * from (
    SELECT DISTINCT                           dbo.Product_Search.Product_Name,     dbo.Product_Search.Product_Code,
                              dbo.Product_Search.Product_ModelNo,  dbo.Brand_Master.Brand_Name,
                              dbo.Product_Search.Product_Kid,   dbo.Product_Search.Product_Image, 
                               dbo.Unit_Master.Unit_Name,   dbo.product_Search.CatName, 
                              dbo.product_Search.ProdName,  dbo.product_Search.ProductDescription, ROW_NUMBER() over(order by Product_Kid) as ROW

                    FROM      dbo.Product_Search INNER JOIN
                              dbo.Brand_Master ON dbo.Product_Search.Product_BrandId = dbo.Brand_Master.Brand_Kid LEFT OUTER JOIN
                              dbo.Category_Index_Master ON dbo.Product_Search.Product_CategoryId = dbo.Category_Index_Master.Category_Kid LEFT OUTER JOIN
                              dbo.Unit_Master ON dbo.Product_Search.Product_MarketPriceType = dbo.Unit_Master.Unit_Kid
                    WHERE     (dbo.Product_Search.Product_Name LIKE '%' + @Keyword + '%') 
                        OR      CategoryIndex_Name LIKE '%' + @Keyword + '%'
                        OR      Brand_Name LIKE '%' + @Keyword + '%'
                        OR      Product_ModelNo LIKE '%' + @Keyword + '%'
                        OR      Product_Code LIKE '%' + @Keyword + '%'
)h
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T16:01:37+00:00Added an answer on May 25, 2026 at 4:01 pm

    Row_Number:
    http://msdn.microsoft.com/en-us/library/ms186734.aspx

    Returns the sequential number of a row within a partition of a result
    set, starting at 1 for the first row in each partition

    So you will have non-unique values always here. Let you try to move ROW to upward:

    SELECT *,ROW_NUMBER() OVER ( ORDER BY Product_Kid ) AS ROW
    FROM    ( SELECT DISTINCT
                        dbo.Product_Search.Product_Name ,
                        dbo.Product_Search.Product_Code ,
                        dbo.Product_Search.Product_ModelNo ,
                        dbo.Brand_Master.Brand_Name ,
                        dbo.Product_Search.Product_Kid ,
                        dbo.Product_Search.Product_Image ,
                        dbo.Unit_Master.Unit_Name ,
                        dbo.product_Search.CatName ,
                        dbo.product_Search.ProdName ,
                        dbo.product_Search.ProductDescription
              FROM      dbo.Product_Search
                        INNER JOIN dbo.Brand_Master ON dbo.Product_Search.Product_BrandId = dbo.Brand_Master.Brand_Kid
                        LEFT OUTER JOIN dbo.Category_Index_Master ON dbo.Product_Search.Product_CategoryId = dbo.Category_Index_Master.Category_Kid
                        LEFT OUTER JOIN dbo.Unit_Master ON dbo.Product_Search.Product_MarketPriceType = dbo.Unit_Master.Unit_Kid
              WHERE     ( dbo.Product_Search.Product_Name LIKE '%' + @Keyword
                          + '%' )
                        OR CategoryIndex_Name LIKE '%' + @Keyword + '%'
                        OR Brand_Name LIKE '%' + @Keyword + '%'
                        OR Product_ModelNo LIKE '%' + @Keyword + '%'
                        OR Product_Code LIKE '%' + @Keyword + '%'
            ) h
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the field: APP_DATE (smalldatetime) I'm doing this query: INSERT INTO table (TYPE,
I have this mysql table called comments which looks like this: commentID parentID type
I have a data tables with this type of setup. Table A AID AName
I have a query like this: SELECT TABLE_NAME, COLUMN_NAME, IS_NULLABLE, DATA_TYPE FROM MY_DB.INFORMATION_SCHEMA.COLUMNS WHERE
i have this simple type from an external webservice: <xsd:element name=card_number maxOccurs=1 minOccurs=1> <xsd:simpleType>
Lets say have this immutable record type: public class Record { public Record(int x,
I have this Javascript data: [{id:123,type:test},{id:154,type:another}] How would you transform that into something so
I have this quiz application where I match what people type with the right
I have this code here, which is intended to allow any type of arguments:
When i execute this query it seems to cause the mysqld.exe process to use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.