I think I have my answer based on a few old threads (they all say it can't be done), but wanted to confirm. Has anyone successfully used expressions to embed a subquery in a SQL FROM clause in PSQuery?
We are trying to problem-solve an issue with an inadvertent Cartesian join in a longstanding query. One solution our DBA's have presented is to basically embed the entire current query in a "wrapper" something like this:
SELECT * FROM (
[Existing query with some additional code to pull ROW_NUMBER() as rn]
)
WHERE rn = 1;
This is easy to do in direct SQL, but to accomplish it in PSQuery you have to embed the current query as a subquery in the FROM clause. There is no obvious way to do that and (as I mentioned) a couple of sources have said it's not possible.
I'm not going to get into specifics of the Cartesian join right now as that's a whole other thing, and we are pursuing a solution from that side. We also found a workaround for the immediate issue. But this "wrapper" technique could help in other scenarios and we wanted to know if it's possible in PS Query.
------------------------------
Aaron Minnick
Functional Lead / Sr. Systems Analyst
Ohio State University-Main Campus
------------------------------
Message from the HEUG Marketplace:------------------------------
Find, Review, and Engage with Higher Education-focused solution providers, products, and services using the
HEUG Marketplace.
------------------------------