Monday, June 30, 2014

Need help in UPDATE data in SQL Query

You have already asked this question once. You did not get any good answers, because you the information you gave was insufficient. And I'm afraid that the information is still in sufficient.


Or more exactly, from the example you have given, the answer is: can't be done. And the reason it can't be done, is as I explained in response to you first thread: there is no information in the data to from which we can deduce that Clorox Company should be under "Week 1-1,K.B,F". The fact that rows are listed in a certain order in the screenshoot is of no importance, because a table is an unordered object.


But you said in another post that you have a timestamp column. Maybe that column is usable - maybe it is not. But at least it is a key that you have more columns that the ones you show.


The best way to get help with this type of problems is to post:


1) CREATE TABLE statement for your table(s).

2) INSERT statements with sample data.

3) The desired result given the sample.

4) A short description of the actual buisness problem you are trying to solve.

5) Which version of SQL Server you are using.


This makes it easy to copy and paste into a query window to develop a tested solution. Screenshots with an insufficient amount of data is not going to help you very much.





Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

No comments:

Post a Comment