Question : Column names in each view or function must be unique

SELECT h.*, m.*, p.* from mnt_Header h
INNER JOIN mnt_MaintenanceRows m ON m.mnt_HeaderID = h.mnt_HeaderID
INNER JOIN mnt_PaymentRows p ON p.mnt_HeaderID = h.mnt_HeaderID

I'm not sure why it isn't treating mnt_HeaderID as unique

Answer : Column names in each view or function must be unique

because you end up with

 select mnt_header,.... mnt_header, ...  mnt_header, ...
 
as you've specified all columns to be available in the view from all tables..

you need to specify each column that you desire individually from the tables...

e.g

select h.mnt_headerID, h.col1,... , M.col1 as MaintCol1 , M.col2 as MaintCol2 , ... , p.col1 as PayCol1, p.col2 as PayCol2, ...

since you don't need to repeat the headerid columns as it the same from each table  
Random Solutions  
 
programming4us programming4us