• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 257
  • Last Modified:

Help required writing a complex query

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
Sreejith22
Asked:
Sreejith22
  • 2
1 Solution
 
CEHJCommented:
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
 
Sreejith22Author Commented:
precisely.

Thanks
0
 
CEHJCommented:
:)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now