Solved

Help required writing a complex query

Posted on 2013-05-15
3
249 Views
Last Modified: 2013-05-15
I have 2 tables:

1) content_permissions

CREATE TABLE content_permissions (`id` integer PRIMARY KEY,
  `tbl_content_common_id` int(10) NOT NULL,
  `userneed_permission_id` int(10) NOT NULL,
  `created` timestamp NOT NULL,
  `modified` timestamp NOT NULL
 )
                                  

Open in new window



2) userneed_permissions

CREATE TABLE `userneed_permissions` (
  `id`  integer PRIMARY KEY,
  `name` varchar(100) NOT NULL,
  `permission_main_title_id` int(10) NOT NULL,
  `description` text NOT NULL,
  `created` datetime NOT NULL,
  `modified` datetime NOT NULL
)
                                  

Open in new window


For a given tbl_content_common_id of the first table(content_permissions) , I need to get all the values corresponding to the name column of second table(userneed_permissions ) with the where condition userneed_permission_id(first table) = id(second table) for a given tbl_content_common_id(first table)
0
Comment
Question by:Sreejith22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 250 total points
ID: 39169228
You mean something like this?

select UP.name from
content_permissions CP
inner join
userneed_permissions UP
on CP.userneed_permission_id = UP.id
where CP.tbl_content_common_id = ?

Open in new window

0
 

Author Comment

by:Sreejith22
ID: 39169260
precisely.

Thanks
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 39169280
:)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
The viewer will learn how to implement Singleton Design Pattern in Java.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question