Merging the table values

Unanswered Merging the table values

  • Tuesday, February 19, 2013 7:10 AM
     
     

    Need to prepare the Merged table as shown in the below, to comare the values from both the Table 1 and Table 2.

    The highlited rows in the merged table are the rows which got changed between the prev table and current table.

    The Table 1 and Table 2 are the temporary  tables, so the merged table should be the Query result on Table 1 and Table 2.

    Thanks in advance.

All Replies

  • Tuesday, February 19, 2013 7:41 AM
    Answerer
     
     
    What is the logic behind of merging? I do not see Start =200 for curr code=11 in both tables

    Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/

    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Blog: Large scale of database and data cleansing
    Remote DBA Services: Improves MS SQL Database Performance

  • Tuesday, February 19, 2013 1:23 PM
    Moderator
     
     

    Hi Shalem,

    There is a complex logic behind your requirement

    For example from 200 to 205 then from 205 to 210, the tsql developer should compare start and end values with each other.

    Can you provide DDL of your tables with sample data script?

    This will help others to answer your question faster and more willingly without additional effort to create sample data


    SQL Server, SQL Server 2012 Denali and T-SQL Tutorials

  • Wednesday, February 20, 2013 3:13 AM
     
     

    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. Learn how to 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 SQL forums. Please do not draw prictures, as tehy are useless. Where are the specs?


    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL