Join records of two Select query using UNION in SQL Server

Last Reply 6 months ago By dharmendr

Posted 6 months ago

How to union the two  same query  as treeview?

select menuname,menuid,formname from Hdmaster where menuid=91

select menuname,menuid,formname from Hdmaster
where menuname='Configuration'

 

Posted 6 months ago

Use Union statement like the below query.

Make sure both the select query have same number of columns.

SELECT menuname,menuid,formname 
FROM Hdmaster WHERE menuid=91
UNION
SELECT menuname,menuid,formname 
FROM Hdmaster WHERE menuname='Configuration'