Hi, Peter,
Retrieve different data from The same table and same column(field) for a form
This is reports on website. The report has 3 fields from 3 tables( Acturally many link tables)
For example:
__________________________________________________ ____________________________________________
Type ( from Type table) User Name(from User table), Firm Name(From Firm table)
A John A1 Firm
A John A2 Firm
A Joe A3 firm
A Joe A4 firm
B Reb B1 firm
B Reb B2 firm
B Mary B1 firm
__________________________________________________ _______________________________________
If type is âAâ, will retrieve user name John, joe ⦠and Frim Name A1, A2⦠Each user name has more than one firms
If type is âBâ, will retrieve user name Reb, Mary ⦠and Frim B1, B2â¦
Each user name has more than one firms
I use the code below:
SELECT allt(user.uname)+ allt(user.name2) as name, allt(firm.fname) as firm FROM user inner join type on user.user_id = type.user_id
inner join firm on type.type_id = firm.pty_id
where type.type="A and Id=@id
SELECT allt(user.uname)+ allt(user.name2) as name, allt(firm.fname) as firm FROM user inner join type on user.user_id = type.user_id
inner join firm on type.type_id = firm.pty_id
where type.type="Bâ and Id= @id
How to code together for a form?
Thanks.
|