Peter,
Yes, I know there are two rows in the course_subject table with a
catalog_number of 520. One has a subject of 'ME' and the other has a
subject of 'MSE'.
What I want is ONLY the 'ME' row (if a row exists with a subject of
'ME').If an 'ME' subject row does not exist, then I want
Tina
What I want is ONLY the 'ME' row (if a row exists with a subject of
'ME').
If an 'ME' subject row does not exist, then I want the other one.
I see. Then to complete spec, what behaviour is desired when there are
two rows with 'ME', or two rows with (course_offer_number = 1 AND
What I want is ONLY the 'ME' row (if a row exists with a subject of
'ME').
If an 'ME' subject row does not exist, then I want the other one.
Ill be offline for awhile so I'll assume answers not available, ie allow
='ME' dupes and 'ME' dupes if they exist. A one-query answer is to
union (i)
Peter,
I really appreciate all the help. Unfortunately, the query you came up
with still returns two rows for catalog_number = 520.
I modified your query slightly to this to qualify a specific catalog_number:
SELECT c.course_id,s.course_offer_number,s.subject
FROM course c
JOIN
I have two tables:
1.) A course table (stores course_id and catalog_number)
2.) A course_subject table (stores course_id, catalog_number, subject,
and course_offer_number)
For each row in the course_table, there can be many rows in the
course_subject table, due to cross-postings among
Tina
Basically, if the subject is ME, then I want to select that row.
If there is no row for that catalog_number that has a subject of ME,
then I want to grab the row that has a course_offer_number of '1'
and a subject that is not equal to ME.
Is this what you mean?
SELECT ...
FROM
Peter,
That was the first query I tried, but for some reason, it still pulled
all of the rows. So I've been trying to come up with another solution.
Any other ideas?
Thanks for the reply.
Tina
Peter Brawley wrote, On 6/26/08 2:12 PM:
Tina
Basically, if the subject is ME, then I want to
Tina,
for some reason, it still pulled all of the rows
Are there multiple rows which meet your WHERE condition? If so, and if
you want just one of them, your need another WHERE condition.
PB
-
Tina Matter wrote:
Peter,
That was the first query I tried, but for some reason, it still
Even if I do a basic select (with no joins) for a given catalog_number,
I still get two rows back.
Even if I do this simple query, while hardcoding in a catalog_number:
SELECT subject, catalog_number FROM course_subject
WHERE (catalog_number = 520) AND
((subject = 'ME') OR
Tina,
Even if I do this simple query, while hardcoding in a catalog_number:
SELECT subject, catalog_number FROM course_subject
WHERE (catalog_number = 520) AND
((subject = 'ME') OR ((course_offer_number = 1) AND (subject NOT LIKE
'ME')))
Errrm, you mean ...subject 'ME'..., don't you!?
I
10 matches
Mail list logo