User Profile
Collapse
-
Working perfectly. Thank you. -
OK, this is as close as I have gotten so far...
SELECT P.FName, P.LName, CASE WHEN (SELECT COUNT(*) FROM TASKS T WHERE T.PID = P.PID) >= 2 THEN 'Task Name' ELSE null END AS TaskName FROM PERSONS P ORDER BY P.PID
This is intended to return the data for all Persons for Task # 2. the CASE switches correctly, I just can't figure out how to select the actual Task instead of just inserting 'Task Name' (it does return the...Leave a comment:
-
I have tried so many bits and pieces, but don't really have anything that has worked. I have tried CASE statements and RANK statements, but can't seem to get it to work. I am a C# developer, so whenever I have needed to "flatten" subrelation data, I have always been inclined to just get the various pieces of data I need separately and put them together in code. Now I am just looking for some more elegant (and faster) ways of retrieving...Leave a comment:
-
Retrieving the Nth record from a one-to-many subrelation table
Using Oracle 10g, I have a "Persons" table and a "Tasks" table, as shown below:
PERSONS Table
=============== ==
PID, FName, LName
-------------------------------
1, John, Smith
2, Bob, Johnson
3, Jane, Walters
TASKS Table
=============== ==
PID, Task#, Task
-------------------------------
1, 1, Change tires
1, 2, Cut grass...
No activity results to display
Show More
Leave a comment: