Monday, April 8, 2013

Find out which report assigned to particular role

Here is common Question is. How to find which report assing to particular role :

Here we have two tables
First one :reportmaster
Create table reportmaster(
Reportid int, reportname varchar(50)
)

Insert into reportmaster(reportname)
Select 1,'sanjay test report'
Union
Select 2, 'sanjay test report1'
Union
Select 3, 'sanjay test report2'

Second table : reportdetail

Create table reportdetail(
Id int,
Reportid int,
Roleid int)

Insert into reportdetail(reportid,roleid)
Select 1,25
Union
Select 2,25

Now question is : which report name like test assigned to role 25.

Solution is :

Select * from reportdetail a
Inner join reportmaster b on a.reportid=b.reportid
Where roleid=25 and reportid in
(Select reportid from reportmaster where reportname like '%test%')

Tag : sql, sql query, sql tables


If you are searching life partner. your searching end with kpmarriage.com. now kpmarriage.com offer free matrimonial website which offer free message, free chat, free view contact information. so register here : kpmarriage.com- Free matrimonial website

Related Posts:

  • Radio Button Control Radio Button control is used, when you want the user to select only one option from the available choices. For example, the gender of a person… Read More
  • ASP.NET TextBox Control The TextBox control is used to get the input from the user of the web application. An asp.net textbox has several properties, that we need to be awa… Read More
  • IIS - Internet Information Services and ASP.NET In this videos we will learn about 1. What is a Web Server 2. Do you need IIS to develop and test asp.net web applications 3. How to check if IIS is… Read More
  • IsPostBack in ASP.NET Suggested Videos Part 3 - ViewState in ASP.NET  Part 6 - ASP.NET Page Life Cycle Events Part 7 - ASP.NET Server Control Events IsPostBack is a… Read More
  • CheckBox Control Suggested Videos: Part 10 - TextBox Control Part 11 - RadioButton Control In this video we will learn about the properties, methods and events of a… Read More

0 comments:

Post a Comment