Select cellection of bit fields if is true ??
-
Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...
jooooo
-
Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...
jooooo
kindman_nb wrote:
.. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True
:doh:
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
-
Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...
jooooo
-
Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...
jooooo
You can create a stored procedure and handle this inside the procedure. However, your problem is in modelling. You should break the table to at least two table. Separate table for Forms and separate table for allowed operations. This way you can query what operations are allowed and those that are not allowed, are not listed. Mika
-
Hi ... I have a table for eg called Forms (fid int , Read bit , Add bit , Del bit ) the problem that more than one row with the same Form like that : fid - Read - Add - Del 2 - True - True - False 2 - True - False - False 2 - True - False - True you can see that the form takes Add True and False in second row .. I want to select only one row but if I have Add col has two value True and False in another row then select True to be : 2 - True - True - True I'm using Sql server 2005 ,, can I create stored procedure do that ... really thanks ...
jooooo
Not sure what you mean, do you mean something like this?:
select fid,max(cast([read] as int)),max(cast([add] as int)),max(cast([del] as int)) from Forms group by fid
-
Not sure what you mean, do you mean something like this?:
select fid,max(cast([read] as int)),max(cast([add] as int)),max(cast([del] as int)) from Forms group by fid
Thanks my friend .. what I mean that for eg .. I have users . every user is subscribe in group and every group has it's permission Read and Add and Del of all forms ... user A is subscribe in Group M and N for eg : customer form : Group M Read true - Add True - Del False Group N Read true - Add False - Del False then i want to select the permission of the user a from the table of permestoin .. you can see that the user has Add is true in group M and the same user has Add is false in group N i want to select True if i hase true or false of the same permissoin .. i hope if you see what mean
jooooo
-
Thanks my friend .. what I mean that for eg .. I have users . every user is subscribe in group and every group has it's permission Read and Add and Del of all forms ... user A is subscribe in Group M and N for eg : customer form : Group M Read true - Add True - Del False Group N Read true - Add False - Del False then i want to select the permission of the user a from the table of permestoin .. you can see that the user has Add is true in group M and the same user has Add is false in group N i want to select True if i hase true or false of the same permissoin .. i hope if you see what mean
jooooo
Ah, OK, well what I posted should help.