Results 1 to 3 of 3

Thread: SQL Query help

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Unanswered: SQL Query help

    Hi all,
    I have 3 tables {unsaccountB and DialogColumn and DialogWatchProperty } that are somehow related to each other. UnsaccountB table has columns job, dept, Center...and DialogColumn tbl has a column named "columnName" that contains all the column names in unsaccountB table. And also unsaccountB tbl and DialogWatchProperty (contains historical column values) tbl are related with column named "objkey". My goal is to have an output like this:
    How would I do that?


    Code:
    oldVal NewValue ColumnName
    ----------------------------------------------
    oldVal1fromDialogWatchProperty  newVal1fromunsaccountB  Job
    oldVal2fromDialogWatchProperty   newVal2fromunsaccountB  Dept
    oldVal3fromDialogWatchProperty   newVal3fromunsaccountB  Center
    ...
    Last edited by emmim44; 07-18-12 at 18:19. Reason: edit

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    The first step that I'd recommend would be to post the CREATE TABLE statements (including all clauses such as CONSTRAINT or FOREIGN KEY definitions) for all three tables, and then post either the raw data in either CSV or BCP form or the INSERT statements to fill those tables with sample data. That will give us enough information to formulate a more detailed reply.

    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

  3. #3
    Join Date
    Jul 2012
    Posts
    2
    Quote Originally Posted by Pat Phelan View Post
    The first step that I'd recommend would be to post the CREATE TABLE statements (including all clauses such as CONSTRAINT or FOREIGN KEY definitions) for all three tables, and then post either the raw data in either CSV or BCP form or the INSERT statements to fill those tables with sample data. That will give us enough information to formulate a more detailed reply.

    -PatP
    I have attached create scripts and tbl data on the txt file.
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •