Re: Problem With SQL UPDATE



SAM (saberb@xxxxxxxxxxx) writes:
HI,
I got this result
Table 1
Col1 Col2 Col3 Col4 Col5
10 4001 F1 1 S
10 4001 F1 1 S
10 4003 F5 3 NULL

but
my required results is

Table 1
Col1 Col2 Col3 Col4 Col5
10 4001 F1 1 S
10 4001 F1 1 P<--------
10 4003 F5 3 NULL
i want a 'P' en the second record not a 'S'

I think you need to explain not only what you want, but also why you want
it. Why would the result be S in one case and P in the other? What does
the columns represent?

The best approach to get good answers for such questions is to post:

o CREATE TABLE statments for your tables. Don't forget to indicate keys.
o INSERT statements with sample data.
o The desired result given the sample.
o A short narrative describing your problem.

With the first three it's to copy and paste into a query editor to
develop a tested query. Also having tables, sample data and narrative
helps to understand the problem.


--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: time conversion hiccup
    ... We have only seen fragments and pieces of what you have been doing. ... statements with sample data, and the desired result given the sample. ... Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books ... ...
    (comp.databases.ms-sqlserver)
  • Re: SQL question
    ... JOIN tbl b ON a.UserID = b.UserID ... INSERT statements with sample data. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Many to one Select
    ... It still possible to define a query that has maximum of columns needed, ... INSERT statements with sample data. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Breaking down Total Hours worked into Day and Evening hours
    ... INSERT statements with sample data. ... Essentially a calendar is a table with one row for each day, ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)
  • Re: Query with Joins problem
    ... The full join operation bulids a table which consists of the ... INSERT statements with sample data. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (comp.databases.ms-sqlserver)

Loading