How to combine tables in qlikview - join

How can I merge two or three tables into one single table and make a big master table in QlikView?
Scenario : I have following 3 Tables. They all contain different facts but i want to merge them and make a big fact table.
(Table#1) Order_Case
OrderID | CaseID | CustomerID | WorkFlowID
(Table#2) Work_Flow
WorkFlowID | WorkFlowStatus | CreatedDate |
(Table#3) Product_Detail
CaseID | ProductID | SupplierID |
What I am trying to achieve : is I want to merge all this tables into a single table so the matching field data should merge and if the field does not match then it should show NULL against it.

This should work just fine, if its not, than you have a problem in one of the "key/join" fields:
Load OrderID ,CaseID,CustomerID,WorkFlowID resident Table#1;
join // or left join
Load WorkFlowID,WorkFlowStatus,CreatedDate resident Table#2;
join
load CaseID,ProductID,SupplierID resident Table#3;

You don't need those merging... as long you have the same Field Name
(as I noticed)
Order_case will be connected to Work_flow by field WorkflowID
and
Order_case will also be connected to Product_Detail by field CaseID
You just need to LOAD them in sequence (all three)
These are star-scheme fact tables, it is quite common and applicable in qlikview, you'll just need to "play along" with the filtering
Hope this can help...

Related

How to apply cascading delete for many to many relationship in Entity Framework? [duplicate]

I have a problem where i need a cascade on multiple foreign keys pointing to the same table..
[Insights]
| ID | Title |
| 1 | Monty Python |
| 2 | Spamalot |
[BroaderInsights_Insights]
| broaderinsight_id | insight_id |
| 1 | 2 |
Basically when either record one or two in the insights table is deleted i need the relationship to also be deleted..
I've tried this:
CREATE TABLE broader_insights_insights(id INT NOT NULL IDENTITY(1,1),
broader_insight_id INT NOT NULL REFERENCES insights(id) ON DELETE CASCADE,
insight_id INT NOT NULL REFERENCES insights(id) ON DELETE CASCADE,
PRIMARY KEY(id))
Go
This results in the warning that the cascade "may cause cycles or
multiple cascade path"
So ive tried adding a cascade to just the insight_id and this results in:
The DELETE statement conflicted with the REFERENCE constraint
Any ideas?
Thanks
Daniel
You'll have to implement this as an INSTEAD OF delete trigger on insights, to get it to work. Something like:
create trigger T_Insights_D
on Insights
instead of delete
as
set nocount on
delete from broader_insights_insights
where insight_id in (select ID from deleted) or
broader_insight_id in (select ID from deleted)
delete from Insights where ID in (select ID from deleted)
Frequently with cascading deletes and lots of foreign keys, you need to spend time to work out a "cascade" order so that the delete that occurs at the top of a "tree" is successfully cascaded to referencing tables. But that isn't possible in this case.

Talend csv to relational db tables : foreign key setting

I'm a Talend beginner and searched about this simple problem, many have posted the web about the same problem but no solution appeared...
I have a csv file with 50 fields, I want to load it into a three tables relational database with Talend. I did a tMap, everything is ok except for foreign key : I don't know how to set them.
Here is my job
Here is my tMap
I hope someone could give me the simple exact solution
Cheers
Pascal
You can do it in two Time.
(CSV) -> (tmap) -> (organisation_output)
|
subjobok
|
| (organisation_input)
| |
(CSV) -> (tmap)-> (country and adress output)
Do a INNER JOIN in the second tmap on column that have unique value for each row.
And load 'ImpID' of your organisation input in the two other output table Impid column.

Sqlite3: Selecting from multiple tables without duplicates

I've got three tables:
paper: items: attachments:
============ ============== ==============
jkey | title itemID | jkey* itemID* | path
*foreign key from another table
I'm trying to retrieve the title of all papers and their associated attachment paths, for all papers that have attachments.
Current attempt is:
SELECT paper.title,attachments.path IN paper,attachments
WHERE paper.jkey IN (
SELECT items.jkey FROM items,attachments
WHERE items.itemID = attachments.itemID
);
Unfortunately this just seems to print gibberish (the same path for different titles and vice versa).
What am I doing wrong?
If you want to join, you should use joins:
SELECT paper.title,
attachments.path
FROM paper
JOIN items USING (jkey)
JOIN attachments USING (itemID);
To omit duplicate rows, use SELECT DISTINCT ... instead.

How to show same column in dbgrid with different criteria

i need your help to finish my delphi homework.
I use ms access database and show all data in 1 dbgrid using sql. I want to show same column but with criteria (50 record per column)
i want select query to produce output like:
No | Name | No | Name |
1 | A | 51 | AA |
2 | B | 52 | BB |
3~50 | | 53~100| |
Is it possible ?
I can foresee issues if you choose to return a dataset with duplicate column names. To fix this, you must change your query to enforce strictly unique column names, using as. For example...
select A.No as No, A.Name as Name, B.No as No2, B.Name as Name2 from TableA A
join TableB B on B.Something = A.Something
Just as a note, if you're using a TDBGrid, you can customize the column titles. Right-click on the grid control in design-time and select Columns Editor... and a Collection window will appear. When adding a column, link it to a FieldName and then assign a value to Title.Caption. This will also require that you set up all columns. When you don't define any columns here, it automatically returns all columns in the query.
On the other hand, a SQL query may contain duplicate field names in the output, depending on how you structure the query. I know this is possible in SQL Server, but I'm not sure about MS Access. In any case, I recommend always returning a dataset with unique column names and then customizing the DB Grid's column titles. After all, it is also possible to connect to an excel spreadsheet, which can very likely have identical column names. The problem arrives when you try to read from one of those columns for another use.

Join multiple FK values in one table

I'm writing some access queries and I'd like some help on a particular query. I'm still very new to SQL. Here is a simplified version of my tables:
Project Details
---------------
projectID (PK)
projectStartDate
projectEndDate
projectName
managerID (FK)
leadID (FK)
coleadID (FK)
Employee
--------
empID (PK)
empName
The managerID, leadID, and coleadID all correspond to an empID. I'd like to retrieve the Project Details table, but replace the IDs with the names of the employees. I've successfully been able to do this for one FK at a time using an inner join, but can't figure out a way to accomplish this for all roles.
It would also be nice to be able to change the attribute names on the results to managerName, leadName, and coleadName.
Thanks!
It's the same way, you probably have done it for one ID:
SELECT pd.*
, emp_m.empName ManagerName
, emp_l.empName LeadName
, emp_c.empName ColeadName
FROM ProjectDetails pd
, Employee emp_m
, Employee emp_l
, Employee emp_c
WHERE pd.managerID = emp_m.empID(+)
AND pd.leadID = emp_l.empID(+)
AND pd.coleadID = emp_c.empID(+)
The (+) is for an outer join, so it will select all records of the ProjectDetails table, no matter if it can match the manager, lead or colead.

Resources