Reputation: 1067
I have 2 tables named as master and kpi.
Master table has following columns
no, name, dtStart, dtEnd, status, user and dtCreate
kpi table has following columns
no and kpName
"no" in kpi table refers "no" in master table
What i expect to do is, when I select a name from the dropdownlist relevant details in both tables should be displayed.
One name has unique "no". Also "no" can have multiple kpNames.
Please help me.
Upvotes: 1
Views: 869
Reputation: 155
You have to make a stored procedure and then join both tables. Here is sample
create proc Details
begin
@Name char(50)
select * from Master m join kpi n ON
m.no==n.no where Name== @Name
end
Upvotes: 2
Reputation: 4192
SELECT table1.[no], table1.name, table1.dtStart, table1.dtEnd,
table1.[status], table1.[user] , table1.dtCreate ,table2.kpName
FROM masterTable [table1]
INNER JOIN kpiTable [table2]
ON table1.[no] = table2.[no]
WHERE table2.Name = 'Your Selected value'
Upvotes: 1
Reputation: 729
try this:
SELECT a.[no], a.name, a.dtStart, a.dtEnd, a.[status], a.[user] , a.dtCreate
From masterTable a
Inner JOIN kpiTable b ON a.[no] = b.[no]
Where b.Name = 'dropDownSelectedValueName'
Upvotes: 2