Solved

Help required writing a complex query

Posted on 2013-05-15
3
250 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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

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

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

724 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