Hello all:
I am in the process of converting our queries and sp's to ANSI standards in
preperation for SQL2000. We currently use SQL7 and 6.5
I am having a problem with this query. I will post the current query which
works and then it will be followed by the ANSI Query.
The problem is I don't see a way to join the company c table to the accounts
eb table.
--------------------------------------------------------------------------- --------------------------------------------------------------------------- JOIN service_enrollment_line_items seli left outer JOIN service_enrollment_terminations st JOIN customer_info ci AND se.enrolled_by = eb.account_id Thanks for the help Gary
---------------------------------------
Current query:
Select se.enrollment_name, a.f_name + ' ' + a.l_name 'Client_Name',
ci.ssn 'SSN', convert(varchar(10),seli.start_date, 101) 'Start_Date',
'date_closed'=case when st.date_closed is null then 'Open'
when st.date_closed is not null then convert(varchar(10), date_closed, 101)
end
From service_enrollments se, accounts a, customer_info ci, company c,
accounts eb,
service_enrollment_line_items seli, service_enrollment_terminations st
where a.account_id = ci.account_id
and a.account_id = se.client_id
AND se.service_enrollment_id = seli.service_enrollment_id
AND se.service_enrollment_id *= st.service_enrollment_id
AND eb.company_id = c.company_id
AND se.enrolled_by = eb.account_id
-----------------------------------------
ANSI Query:
Select se.enrollment_name, a.f_name + ' ' + a.l_name 'Client_Name',
ci.ssn 'SSN', convert(varchar(10),seli.start_date, 101) 'Start_Date',
'date_closed'=case when st.date_closed is null then 'Open'
when st.date_closed is not null then convert(varchar(10), date_closed, 101)
end
From service_enrollments se
ON se.service_enrollment_id = seli.service_enrollment_id
ON se.service_enrollment_id = st.service_enrollment_id
*****************************************************
JOIN accounts eb
<-------------Here is the area that is in question
ON eb.company_id = c.company_id
*****************************************************
JOIN accounts a
ON a.account_id = se.client_id
ON a.account_id = ci.account_id
---------------------------------------------------------------------------
------