SQL QUERY HELP

  • Or use MERGE. This will handle the case where you have new fruits in the first table that aren't in the second.

    John

  • Hi,

    Thats a question....where should i use the update statement...in front of select or after group by...the thing is when i set my column names equal to result table column names it doesnt recognize it.

  • Can i Do Delete from table and the INSERT new record into the table?

    what are the potential hazards?

  • Yes, that should work, provided it doesn't break any referential integrity. Otherwise, use UPDATE with a JOIN, or MERGE.

    John

  • Open up Books Online (the SQL help file, F1 in Management Studio), search for UPDATE and have a look at the syntax.

    Yes, you can delete and insert, but why would you when there's an UPDATE statement and you're intending to update the row?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 5 posts - 16 through 19 (of 19 total)

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