Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)

I have 3 tables

1) TM_Company (compID,CompName)
2) tm_Customer(custId,CName,CompID)
3) tm_booking(bID,Amount,CustID,CompID)

data in table


1) tm_Company

1, abc
2, def
3, xyz


2) tm_customer

1, jagdish,1
2, ghi,    1
3, jkl,    1
4, iuy,    2
5, lkj,    2
6, lskdfj, 2

3) tm_booking

1, 12000,  1, 1
2, 123000, 2, 1
3, 2345,   3, 1
4, 1234,   1, 1
5, 123,    1, 1
6, 456,    6, 2
7, 2334,   4, 2
8, 123000, 2, 1


now I want to show data customer wise bt from selected company means if i had logged in company 1 then only customers of company 1 should be display


Company Name : CompName

CustName
         Bid   amount   

result should be


Company Name : ABC

CustName 
         Bid Amount

Jagdish
        1 12000
        4 1234
        5 123
ghi     
        2 123000
        8 45600
jkl
        3 2345

Here CompID should be taken dynamically if user is logged in in compID 1 then all data will be display of compID 1 
Posted
Updated 29-Mar-13 1:14am
v3

1 solution

You write one query which is retriving data for you like

SQL
select Co.CompanyID,Co.CompanyName,Cu.CustId,Cu.CName,B.bID,B.Amount from
TM_Company Co inner join TM_Customer Cu on Co.CompID=Cu.CompID inner join Tm_Booking on  cu.Custid=B.CustId and Co.CompID = b.CompID
where co.CompID='Selected Company'


You must need to pass the company code wich is selected at the time of login.

Then after that pass the Query to your report and add 3 group in report
CompID ,CustID ,bID respectivaly.

And then design the report as per your requirement.
 
Share this answer
 
Comments
jagdish123061 29-Mar-13 9:44am    
thanx bt I'had already tried this on bt not working....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900