Google Search Results

Clear Results

WebCOBRA.com Community Message Boards

Relational API Database

jcox
Posts: 1
Since: 06/24/2008

Linking Users to a Company
06/24/2008 07:36 AMReply

Hello,

Is there a way to link a user in the Users table to a company in the Companies table?

I see that this is possible if the user type is 3 becuase you could use the QBAutoID to join to QB and so on to join to Companies. But is there a way to link to a Company for the other user types?

Thanks,
Justin



jwolgamott
Posts: 257
Since: 09/26/2005

RE: Linking Users to a Company
06/24/2008 11:25 AMReply

Justin --

Yes, but since Users can have access to All (or a subset) of companies, it gets a little complicated.

Here's a query you can use that will show either All Companies or have 1 record per Company that the user has access to.

select users.userlogin, isnull(companies.companyname, 'ALL COMPANIES') from users
left outer join securityxrf on users.userid = securityxrf.userid
left outer join companies on companies.companyid = securityxrf.companyid
order by users.userlogin



Systems should be free (to interact with others)
Return to Forum