April 26, 2012 at 11:56 am
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.
April 26, 2012 at 12:00 pm
select partnumber, count(distinct partdesc)
from parttable
group by partnumber
having count(distinct partdesc) > 1
April 26, 2012 at 12:01 pm
a table or a column???
please post what your data looks like.
April 26, 2012 at 12:34 pm
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.
April 26, 2012 at 2:13 pm
CELKO (4/26/2012)
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.
April 26, 2012 at 7:15 pm
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 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
April 26, 2012 at 10:08 pm
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. 😉
April 26, 2012 at 11:11 pm
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: 😀
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply