I just tried to do a correlated subquery in the FROM clause of a SELECT statement in Oracle, but I was given an error indicating that I couldn't do the correlation (something to the effect that Obs.pID was not recognized). Should this work?
FROM ml.Person Person
JOIN ml.Obs ON Person.pID = Obs.pId
JOIN (SELECT ObsMax2.pId, ObsMax2.h...
Hi,
Consider the following query in PostgreSQL:
SELECT
a, b,
(A VERY LONG AND COMPLICATED SUBQUERY) AS c,
(ANOTHER VERY LONG AND COMPLICATED SUBQUERY) AS d
FROM table
I want to have c and d in the WHERE clause, like:
WHERE c AND d;
But, as far as I know, I can only do:
WHERE A VERY LONG AND COMPLICATED SUBQUERY) AND
...
This is a complicated situation (for me) that I'm hopeful someone on here can help me with. I've done plenty of searching for a solution and have not been able to locate one. This is essentially my situation... (I've trimmed it down because if someone can help me to create this query I can take it from there.)
TABLE articles (article...
I have two separate tables used for categories.
One is Categories(ID, Title, Description), and the other is SubCategories(ID, UpperID, Title, Description)
I want to insert the records from categories to SubCategories with upperID=0. I've looked at SQL SELECT INTO but don't know how to use it for existing tables.
...