on 05-18-2015 7:48 PM
Hello I have a table that has data from two sources but have same ID
ID | A | B | C | D |
123 | xyz | xxy | xxd | xxa |
123 | abc | abd | def | xxr |
I want to create a table that uses partial data from both rows
123 | xyz | xxy | def | xxr |
How can i Do this?
Hi,
it depends on how you want to get the valueas for the rows. In your example your getting , for A column, the value from the first row, but in column C, you´re getting from the second one.
Regards,
Rogerio
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you are new to the derived table concept, it is good to know and in the future you can solve many of your problem with this : find details here
Your derived table will have the SQL code as outline below :
SELECT
Table_A.ID,
Table_A.A,
Table_A.B,
Table_B."C ",
Table_B.D
FROM
Table_A INNER JOIN Table_B ON (Table_A.ID=Table_B.ID)
Regards,
Naras
Follow the above method, if you can get the data in two tables and you want the result set in one view.
But what if you have only one table for both the sources(combined data). It is a kind of reverse engineering but for some reason if you have no control over the tables from the source, follow the below method (note, you will need to have a column "datasource" to check from where the data is coming)
Create two alias tables (just one is enough but to keep the original table intact, create two) and insert a self join with filter on Datasource. Now drag and drop the objects that you want and you will get the desired results.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.