best practise for 2 colums from 2 different tables
Dear all,
what could be the best practise for this:
query all contracts and show in left column
query all related offers and show them in the right category / row in the right column
--
I have problems how to query ... i tried it with union, but this wont work. 2 separate datasets will not work too, cause in the table is only one dataset possible. subreports wont work, because i need to sum in subreport and compare to a sum in mainreport
or to a sum in another subreport.
Report should look like this
left column (group???) = contract
could be 0, 1 or more contracts
right column (group???) = offer
could be 0, 1 ore more offers
---
this means that if there is now only 1 contract, there could be 2 offers for this 1 contract
but
it could also be NO contract and there will now be 1 offer
OR
it could be 2 contracts now and there will only be 1 offer
OR
1 contract now and NO offer
----
I dont know if i should get the contrats and offers in 1 dataset. but how could i get it working, that the contracts and offers are at the same row or group or height.
---
Is it possible to have 1 row
then 2 lower colum groups
-----
btw:
there is a n:n realationship from contract to offer. This may help. but what if in case one side has no resultrow, f.e. there is no contract but later there will be 1 offfer against.
-------
.......................... i dont know how to start and to get it working?
hope there will be hope for me :-(
thx greets pit
July 18th, 2012 5:52pm
Hi There
Thanks for your posting. I have tried to put something together for you. As Im not really sure what is your data structure look like but I have quickly created two table with the following
structure
SELECT [OfferID]
,[ContractID]
,[OfferName]
FROM [TEST_DWH].[dbo].[Offer]
GO
SELECT [ContractID]
,[ContractName]
FROM [TEST_DWH].[dbo].[Contract]
GO
n
This query will make sure if there is no offer or no contract it still display the records
SELECT dbo.Offer.OfferID,
dbo.Offer.OfferName,
dbo.Contract.ContractID,
dbo.Contract.ContractName
FROM
dbo.Offer
FULL OUTER
JOIN
dbo.Contract
ON dbo.Offer.ContractID
= dbo.Contract.ContractID
SELECT [OfferID]
,[ContractID]
,[OfferName]
FROM [TEST_DWH].[dbo].[Offer]
GO
SELECT [ContractID]
,[ContractName]
FROM [TEST_DWH].[dbo].[Contract]
GO
n This query will make sure if there is no offer or no contract it still display the records
SELECT dbo.Offer.OfferID,
dbo.Offer.OfferName,
dbo.Contract.ContractID,
dbo.Contract.ContractName
FROM
dbo.Offer FULL OUTER JOIN
dbo.Contract
ON dbo.Offer.ContractID = dbo.Contract.ContractID
I am putting some screenshot so if you have any questions please do ask
Many thanks
Syed Qazafi Anjum
Free Windows Admin Tool Kit Click here and download it now
July 18th, 2012 6:51pm