Home » SQL & PL/SQL » SQL & PL/SQL » Can someone point me in the right direction
Can someone point me in the right direction [message #629750] Mon, 15 December 2014 20:32 Go to next message
morrism35
Messages: 10
Registered: December 2014
Junior Member
Not asking someone to do this for me but at least point me in the right direction. My idea is select * from tasks where
&taskId=StatusID; Something is missing here if only this where java or c++ I could use a IF lol. This is
a extra credit for my final exam. I finished my final but this one is one of those out of the way questions
that instructors ask you. It's due by midnight so I'm really working hard on this one since late last night.


The instructors want to be able to select all of the tasks that have the same task as one that they are viewing.
Please create a query that will allow them to select all of the tasks with the same status as a task that they enter by TaskID.


Tablename: Tasks
Fieldname Datatype Null Comments
TaskID Number(3) Not null Unique identifier for the table
TaskName Varchar2(20) Not null Name of the task
TaskDesc Varchar2(20) Null Details of the task
DueDate Date Null Task due date
PriorityID Char(1) Null FK to Priority table
StatusID Char(1) Null FK to Status table

Tablename: Priority
Fieldname Datatype Null Comments
PriorityID Char (1) Not null Unique identifier for the table
PriorityName Varchar2(20) Not null Assigns priority level to a task


Tablename: Status
Fieldname Datatype Null Comments
StatusID Char(1) Not null Unique identifier for the table
StatusName Varchar2(20) Not null Assigns a category to a task
Re: Can someone point me in the right direction [message #629751 is a reply to message #629750] Mon, 15 December 2014 20:58 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>Please create a query that will allow them to select all of the tasks with the same status as a task that they enter by TaskID.

since TASKID is UNIQUE, only one row will be returned so I fail to not understand what exactly is your problem
Re: Can someone point me in the right direction [message #629752 is a reply to message #629751] Mon, 15 December 2014 21:17 Go to previous messageGo to next message
morrism35
Messages: 10
Registered: December 2014
Junior Member
select all of the tasks with the same status as a task that they enter by TaskID. From what I understand is
user enters the taskId which I did. I all tasks with the same states as the taskid tasks that I entered.
Re: Can someone point me in the right direction [message #629753 is a reply to message #629752] Mon, 15 December 2014 21:20 Go to previous messageGo to next message
morrism35
Messages: 10
Registered: December 2014
Junior Member
Maybe this will help. If I choose TaskId 42 with a 'S' for Status then rows 2 and 3 should be displayed also.


TASKID TASKNAME TASKDESC DUEDATE P S
---------- -------------------- -------------------- --------- - -
42 Final Exam Chapters 1-9 06-MAY-13 H P
1 Midterm project Chapters 1-6 09-APR-13
2 Read chapter Chapters 7 11-APR-13 P
3 Lab assignment Chapters 7 16-APR-13 P
Re: Can someone point me in the right direction [message #629754 is a reply to message #629752] Mon, 15 December 2014 21:23 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
MERRY CHRISTMAS!
SELECT taskid 
FROM   tasks 
WHERE  statusid = (SELECT statusid 
                   FROM   TASK 
                   WHERE  taskid = &taskid); 
Re: Can someone point me in the right direction [message #629755 is a reply to message #629754] Mon, 15 December 2014 21:26 Go to previous messageGo to next message
morrism35
Messages: 10
Registered: December 2014
Junior Member
A nested statement I remember reading that. Thanks need too reread that section.
Re: Can someone point me in the right direction [message #629770 is a reply to message #629755] Tue, 16 December 2014 00:29 Go to previous message
Michel Cadot
Messages: 68645
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

Before your next question, Please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.

Also always post your Oracle version, with 4 decimals.

Previous Topic: Using "&" in the password is recommended ??
Next Topic: dynamic sql column concat
Goto Forum:
  


Current Time: Wed Apr 24 18:57:00 CDT 2024