HI
I have 2 table in database
1-House_info
Id
|
Name
|
Behcode
|
Subset
|
H_name
|
1
|
Sara
|
1111
|
Electric
|
House
|
2
|
Jack
|
2222
|
|
House
|
3
|
Micheal
|
3333
|
|
House
|
2-House_p
Id
|
Model
|
Behcode
|
Subset
|
H_name
|
1
|
Sofa
|
2222
|
Furniture
|
House
|
2
|
Chair
|
2222
|
Furnitue
|
House
|
3
|
Curtain
|
3333
|
Curtain
|
House
|
in House_info saved Users information and in House_p saved users Product Information
I have datalist in my page that bind from House_info table and if users insert their produt in House_p, their information from House_info will be bind ...
below is SP
ALTER procedure [dbo].[GetCustomersPageWise2]
@H_name nvarchar(50)
,@subset nvarchar(30)
,@PageIndex INT = 1
,@PageSize INT = 5
,@RecordCount INT OUTPUT
,@Id int
AS
BEGIN
select distinct House_Info.Name,MAX(House_p.[Date]) as [Maxdate],House_Info.BehCode,House_Info.ID
into #Temp
from House_Info
Inner Join House_p ON House_Info.Behcode = House_p.Behcode
where ([House_p].H_name=@H_name or [House_p].subset=@subset)
group by House_Info.ID,House_Info.Name,House_Info.BehCode
order by [Maxdate] desc
SELECT ROW_NUMBER() OVER
(
order by [Maxdate] desc
)AS RowNumber, *
INTO #Results
FROM #Temp
SELECT @RecordCount = COUNT(*)
FROM #Results
SELECT * FROM #Results
WHERE (RowNumber BETWEEN(@PageIndex -1) * @PageSize + 1 AND(((@PageIndex -1) * @PageSize + 1) + @PageSize) - 1)
DROP TABLE #Results
DROP TABLE #Temp
END
Here if users insert Their product into House_p table in datalist shows their information from House_info Table so here just shows users with behcode=2222,3333
in HOuse_p table is Subset column if users select Item from menubar in Product.aspx page according to their selected Item it will show information in datalist
i.e
if they select Furniture from menubar it shows users information from House_info table that they inserted product with subset=furniture in house_p table
now I want if users select item=Electric from menubar it shows users information from House_info table that subset=Electric (but she didn't insert any Product in House_p table)
in above SP it just show users that insert Product in house_p table
I want shows both of them...
I hope explain clearly..
Thanks alot
NEDA