Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have 2 tables with 2 fields.
Table1:
ID Name
1 Dog
2 Cat
3 Cow
Table2:
ID Disc
1 Bark
1 Puppy
2 Meow
2 Kitten
3 Mooo
3 Calf
I want the o/p
ID Animal
1 Dog
1 Bark
1 Puppy
2 Cat
2 Meow
2 Kitten
3 Cow
3 Mooo
3 Calf
How can I achieve this.
Thank you very much
Try this:
Table1:
load ID,
Name as Animal Inline [
ID , Name
1 , Dog
2 , Cat
3 , Cow
];
Table2:
LOAD ID,Disc as Animal
INLINE
[
ID, Disc
1 , Bark
1 , Puppy
2 , Meow
2 , Kitten
3 , Mooo
3 , Calf
]
You can try wit join table
Table1:
load
ID & Name as %key
..
join(Table1)
load
ID & Disc as %Key
..
Hi,
Try this:
Table1:
load * inline [
ID,Name
1,Dog
2,Cat
3,Cow
];
join
Table2:
load ID,Disc as Name inline [
ID,Disc
1, Bark
1, Puppy
2, Meow
2, Kitten
3, Mooo
3, Calf];
Hi Pavana,
Robert's Solution is correct.
Similar structure tables will auto concatenate as per qlikview, field names should be renamed for fields containing similar data, you can use concatenate keyword to merge two tables as well.
Table1:
load ID,
Name as Animal Inline [
ID , Name
1 , Dog
2 , Cat
3 , Cow
];
Concatenate
Table2:
LOAD ID,Disc as Animal
INLINE
[
ID, Disc
1 , Bark
1 , Puppy
2 , Meow
2 , Kitten
3 , Mooo
3 , Calf
]
Robert used a concatenate
Arjiun a join
and the result is the same, I think both are correct for this question
As per input tables i think join is more appropriate,but as per requirement concatenate works fine.
join(its outer join and join creates various combination of records) and concatenate just merges both tables
and same number of records are displayed.
Hi Pavana alva , Did you able to get the solution?
See attached qvw.