Solved

Help required writing a complex query

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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how the fundamental information of how to create a table.

825 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