I have a function GetBestPrice that returns a table of values that are pulled from a union select query on 15+ Tables
I then call the function to get
SELECT * FROM
GetBestPrice()
WHERE Price IN
(
SELECT Min(Price)
FROM GetBestPrice()
WHERE STOCK > 0
)
This does work, but I have a strong feeling that it is not the most efficient way of getting a whole row from the union query.
The union is
Select * from Table 1
UNION
Select * from Table 2
etc
I then call the function to get
SELECT * FROM
GetBestPrice()
WHERE Price IN
(
SELECT Min(Price)
FROM GetBestPrice()
WHERE STOCK > 0
)
This does work, but I have a strong feeling that it is not the most efficient way of getting a whole row from the union query.
The union is
Select * from Table 1
UNION
Select * from Table 2
etc