Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.

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 29-Mar-13 2:10am
Edited 29-Mar-13 2:14am
v3

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

You write one query which is retriving data for you like
 
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.
  Permalink  
Comments
jagdish123061 at 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)

  Print Answers RSS
0 OriginalGriff 584
1 Maciej Los 275
2 DamithSL 233
3 Sergey Alexandrovich Kryukov 209
4 BillWoodruff 200
0 OriginalGriff 6,803
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,421
3 Manas Bhardwaj 4,841
4 Maciej Los 4,330


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100