user6592730 user6592730 - 1 year ago 62
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 Source

try this:

SELECT a.[no],, 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'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download