Click here to Skip to main content
15,894,646 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi every one I have two table Photogallary and images, i insert the image ,imagellocation and imageid in images table, and in Photocategory i insert imageid and imagecategory. i want to display these image details on the front page with the help of datalist.

Problem: I want to display imagecategory from the photocategory table, but the  problem is that how can we merge two tables data in a single datalist,
I need query for this problem, i think there i need inner join related query.
Can any one help me please..

Thanks in advance...
Posted

I think you know the solution, you need to use Joins in SQL query. If you have problem in syntax of inner join, so this could help.

SELECT column_name(s)
FROM table_name1
INNER JOIN table_name2
ON table_name1.column_name=table_name2.column_name


You can also refer,

http://www.w3schools.com/sql/sql_join_inner.asp[^]
 
Share this answer
 
Comments
ManavGuru 24-Nov-11 2:44am    
I need query, i only guess may be i can use join query
Similar question 2 hours ago Read the Dataset in asp.net combine two tables[^]
 
Share this answer
 
SQL
USE [UDJTC]
GO
/****** Object:  StoredProcedure [dbo].[usp_GetFeaturedMemberDetailPi]    Script Date: 11/24/2011 10:21:49 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER Proc [dbo].[usp_GetFeaturedMemberDetailPi]

AS
with a as
(
select *, CHARINDEX('/', Reg_No)+1 c   from LM_commiteemember
), b as
(
select *, CHARINDEX('/', Reg_No, c)-1 d   from a
)
, d as
(
select * , SUBSTRING(Reg_No, 1, c-2) f, cast(SUBSTRING(Reg_No, c, d-c+1) as int) e   from b
)
select * from d order by f, e
 
Share this answer
 

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