Click here to Skip to main content
15,913,055 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
in my database there are two tables category_table and sub_category table.
category table- id,categoryname,category status
subcategory table=id,subcategory_name,category id,subcategory_status


now i want to display the category_name which should have id as categoryid using ms access.
Posted
Updated 1-Jul-13 3:24am
v2
Comments
Prasad Khandekar 1-Jul-13 9:26am    
Not very clear. If you just want to display category_name for an id then it's going to be s simple select on category table with a where clause.

Regards,
Pradeep_Kumar_Verma 1-Jul-13 9:43am    
Hi,
try this query.

select * from category_table ,sub_category where category_table.id = sub_category.Category_id
Tricube 2-Jul-13 0:37am    
shows an eror 'type mismatch in expression'

Try:
SQL
SELECT categoryname FROM categoryTable WHERE id=666
 
Share this answer
 
as much i have understood your question u have two tables and u want to show the data from second table whose id is in first table too, is it?? if yes you can do it simply
SELECT category_name FROM SubCategory a IINER JOIN Category b ON a.ID = b.ID
 
Share this answer
 
Comments
Tricube 2-Jul-13 0:33am    
shows an error 'from'
bunzitop 11-Jul-13 2:27am    
SELECT category_name FROM SubCategory a INNER JOIN Category b ON a.ID = b.ID

USE IT
previously there was IINER in place of INNER

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900