Let's say you have a completely separate database, Oracle, SQL Server or the data resides on a separate server where they can't be UNIONed directly (this happens to us with an (PeopleSoft/Oracle) ERP database and an engineering DB (MySQL) for test results). You can do the query on one of the DBs, keep the result set in memory and construct a query like this:
SELECT '' AS SN, 'PRD0547016' AS Prdn_ID UNION
SELECT '' AS SN, 'PRD0547435' AS Prdn_ID UNION
SELECT sn, pid AS Prdn_ID
FROM build left join product on prod_idx=product.idx WHERE sn='23456-1'
AND PID not in ('dgh')
ORDER BY Prdn_ID;
In this particular case, I end up with:
'23456-1', 'pid 2'
'23456-1', 'pid 3'
'', 'PRD0547016'
'', 'PRD0547435'
I had wanted to SELECT INTO, yada, yada..., but transferring files from server to server, creating temporary tables, etcetera; was too much programming and I'll bet this is the computationally fastest solution too.