Multiple Part Descriptions

  • I have a table that contains part numbers with multiple descriptions. Any know of an easy way to identify just those part numbers with more than one part description? Any help will be appreciated.

  • select partnumber, count(distinct partdesc)

    from parttable

    group by partnumber

    having count(distinct partdesc) > 1

  • a table or a column???

    please post what your data looks like.

  • I was looking at a stock table with the columns Part Number and Part Description. I just found out that we have over 95 tables that contain these two columns, so I am scraping this project. I have no idea how I would go about correcting the dups in each, especially when the same part number may reside in each table and have a different description in each table. This was just bad database design.

    Thanks for the replies.

  • CELKO (4/26/2012)


    Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. If you know how, follow ISO-11179 data element naming conventions and formatting rules. Temporal data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.

    This is minimal polite behavior on a SQL forum.

    Sample data is also a good idea, along with clear specifications. It is very hard to debug code when you do not let us see it. If you want to learn how to ask a question on a Newsgroup, look at: http://www.catb.org/~esr/faqs/smart-questions.html%5B/quote%5D

    Little late to this party, Mr. Celko. The OP has already decided to scrap this project.

  • I was looking at a stock table with the columns Part Number and Part Description. I just found out that we have over 95 tables that contain these two columns, so I am scraping this project

    Lynn - I think he's going to scrape the project.


    My mantra: No loops! No CURSORs! No RBAR! Hoo-uh![/I]

    My thought question: Have you ever been told that your query runs too fast?

    My advice:
    INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
    The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.

    Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
    Since random numbers are too important to be left to chance, let's generate some![/url]
    Learn to understand recursive CTEs by example.[/url]
    [url url=http://www.sqlservercentral.com/articles/St

  • dwain.c (4/26/2012)


    I was looking at a stock table with the columns Part Number and Part Description. I just found out that we have over 95 tables that contain these two columns, so I am scraping this project

    Lynn - I think he's going to scrape the project.

    Yes, I agree. That's what I told Mr. Celko, also. 😉

  • Lynn Pettis (4/26/2012)


    dwain.c (4/26/2012)


    I was looking at a stock table with the columns Part Number and Part Description. I just found out that we have over 95 tables that contain these two columns, so I am scraping this project

    Lynn - I think he's going to scrape the project.

    Yes, I agree. That's what I told Mr. Celko, also. 😉

    Guys - I think he's going to scrape the project.

    Lol!!!!!!!!!!!!!!!!.....This could go on all day.... 😀 😀 :hehe: 😀

    Vinu Vijayan

    For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden[/url] 😉

Viewing 8 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply