user6592730 user6592730 - 1 month ago 6
SQL Question

How to retrieve multiple data in a column of a table using a query?

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.

Answer

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'