I have 4 Select statements for 4 different tables
each Select query gives latest record meeting specified condition
for ex:
Select TOP 1 * from table where column_name = 'something' order by col1 DESC;
Now I have to combine result set of all 4 queries and create a view from combined result set.
Some DB’s don’t let you provide an “order by” clause inside on of the unioned queries.
If you’re ordering by col1 desc, it’s possible that it’s some type of column you can apply min() or max() to.
If that is the case, below could solve your issue (if there aren’t too many records, or, if the tables are massive, “col1” and “some_column” are indexed.)