Combine 2 fields from 5 tables into one list?

  • Please can anyone help, I have 5 SQL tables (T1, T2, T3, T4, T5) which contain just 2 fields: UserID and Timestamp

    I need to read each table and pulls in the USERID and DateStamp and somehow display the data as follows:

    UserID T1 T1 Date T2 T2 Date T3 TdDate T4 T4Date T5 T5Date

    UserA Yes 01/01/1999 Yes 02/02/1999

    The Yes just displays that there is an entry in that Table.

    So basically, the UserID may exist in one or more tables, other times the UserID might just appear once.

    Where the USERID appears there is always a Timestamp field entry, so I just need to somehow pull the data together and put a YES and Date in the column.... There are literally only 300 records in total for all the 5 tables, so not much data at all.

    Can anyone please help, don't know if this is easier with SQL or a SRSS report?

    Thanks

  • rkelly58 (10/4/2016)


    Please can anyone help, I have 5 SQL tables (T1, T2, T3, T4, T5) which contain just 2 fields: UserID and Timestamp

    I need to read each table and pulls in the USERID and DateStamp and somehow display the data as follows:

    UserID T1 T1 Date T2 T2 Date T3 TdDate T4 T4Date T5 T5Date

    UserA Yes 01/01/1999 Yes 02/02/1999

    The Yes just displays that there is an entry in that Table.

    So basically, the UserID may exist in one or more tables, other times the UserID might just appear once.

    Where the USERID appears there is always a Timestamp field entry, so I just need to somehow pull the data together and put a YES and Date in the column.... There are literally only 300 records in total for all the 5 tables, so not much data at all.

    Can anyone please help, don't know if this is easier with SQL or a SRSS report?

    Thanks

    I've put a possible solution that will work in either an SSRS dataset or as T-SQL on your question in the other forum.

    Please don't cross-post, it splits answers and you won't get the best help.


    On two occasions I have been asked, "Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?" ... I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question.
    —Charles Babbage, Passages from the Life of a Philosopher

    How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537

  • When directing answers to another forum, it really helps to post a link to that other forum.

    http://www.sqlservercentral.com/Forums/Topic1823226-150-1.aspx

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

Viewing 3 posts - 1 through 2 (of 2 total)

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