Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 select query help

Author  Topic 

muvvasiva
Starting Member

14 Posts

Posted - 2009-06-23 : 07:11:49
hi ALL,
temp table has the following data


ID MENUID READPERMISSION WRITEPERMISSION MODIFYPERMISSION
== ====== =============== ================ ================
1...4........Y................N.................N
2...4........N................N.................Y
3...4........Y................N................ N
4...5........Y................N................ N

I placed dots between the values for redability
Here , i have to select distinct MENUID from this table.
After selection i should get the data as follows.

ID MENUID READPERMISSION WRITEPERMISSION MODIFYPERMISSION
=== ====== ============== ================ =================
1.....4...........Y................N...................Y
4.....5...........Y................N...................N

in the above data(before selection) MENUID=4 has 3 rows
In any row for MENUID=4 if READPERMISSION field has value 'Y' then i need to select 'Y'
similarlly for WRITEPERMISSION and MODIFYPERMISSION fields also.

Pls help me

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-06-23 : 07:16:38
So basically, what you are telling us, is that the YES permission has higher presedence than NO permission?

SELECT MIN(ID), MenuID, MAX(ReadPermission), MAX(WritePermission), MAX(ModifyPermission)
FROM Table1
GROUP BY MenuID



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

muvvasiva
Starting Member

14 Posts

Posted - 2009-06-23 : 07:25:10
Hello peso,


Thank u very much

Go to Top of Page
   

- Advertisement -