Link to home
Create AccountLog in
Avatar of Amanda Walshaw
Amanda WalshawFlag for Australia

asked on

select statements

hello writing a select statement on user group permissions, I am using joins to each table, fields are  ids I am linking to for each table.
Its 4 tables I am linking but I selecting only one user id and I getting over 32K thousand results.
select distinct a.group_id, a.group_name, a.group_desc, b.user_id, 
d.app_id, d.form_id, d.read_perm, d.write, e.app_name
from dbo.GroupHead a
join dbo.groupheaddet b
on a.group_id = b.group_id
join groupperm d
on a.group_id = d.group_id
left join smapp e
on d.app_id = e.app_id
and a.group_id = '22'
and b.user_id = '33'

Open in new window

SOLUTION
Avatar of Saurabh Bhadauria
Saurabh Bhadauria
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Avatar of Pratima
Pratima
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Amanda Walshaw

ASKER

hello patrima and Qlemo, yes I put in the where clause but I am still getting 101 thousand results.
I have to link back to the application name to get what the user is using within the group, ie under AR TEAM for example they access Cash Receipts, Invoices etc
The issues occur when i add the smapp there is no reference to groupapplications.
so the whole query is blowing out

I think we have issues with single permissions reference to group permissions its the user_id I think
I will keep plugging away
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account