Everytime I try to run a subquery, I always get the following error:
[error]
ORA-00933: SQL command not properly ended
[error]
Here are two examples. The 1st is a large one, and the 2nd one is more paired down, because I'm trying to figure out where the error is, but Golden always points to where the subquery begins.
1st query
select p1.associate_id, p1.application_id, p1.entity_id, p1.profile_id, p1.language, p1.neutrals, p1.created_date, p1.sf_completed_date,
p1.completed_time, p1.parent_respondent, p1.parent_aid, p1.attempt, p1.parent_attempt, p1.reported_top1, p1.reported_top2, p1.reported_top3,
p1.reported_top4, p1.reported_top5, p1.top1, p1.top2, p1.top3, p1.top4, p1.top5
from sf.profiles p1
where p1.sf_completed_date < to_date('15-June-2006 00:00:00', 'DD-MM-YYYY HH24:MI:SS')
and p1.parent_respondent is null
and p1.parent_aid is null
and p1.neutrals < 155 in (
select nvl(max(p2.attempt), 0)
from sf.profiles p2
where p2.associate_id = p1.associate_id);
2nd query
select p1.language, pl.neutrals, p1.top1, p1.top2, p1.top3, p1.top4, p1.top5
from sf.profiles
where p1.parent_respondent_id is null (
select nvl(max(p2.attempt), 0)
from sf.profiles p2
where p2.associate_id = p1.associate_id);
I'm not sure what I'm doing wrong, is there anything that I can read up on to get better at these?
I found this via Google
http://www.lc.leidenuniv.nl/awcourse/oracle/server.920/a96540/queries.htm#2057934
thanks