Adaptive Server releases 12.0 and later support ANSI joins. Sybase recommends that you rewrite applications to use ANSI outer joins because they specify unambiguously whether the on or where clause contains the predicate. Transact-SQL syntax in previous releases was ambiguous in some cases.
ANSI syntax allows you to write either of these types of joins:
Inner joins – the joined table includes only the rows of the inner and outer tables that meet the conditions of the on clause. The result set of a query that includes an inner join does not include any null supplied rows for the rows of the outer table that do not meet the conditions of the on clause. The syntax for an ANSI inner join is:
select select_list from table1 inner join table2 on join_condition
For example:
select au_id, titles.title_id, title, price from titleauthor inner join titles on price > 15
Outer joins – the joined table includes all the rows from the outer table whether or not they meet the conditions of the on clause. If a row does not meet the conditions of the on clause, values from the inner table are stored in the joined table as null values. The where clause of an ANSI outer join restricts the rows that are included in the query result. ANSI syntax also allows you to write nested outer joins. The syntax for an ANSI outer join is:
select select_list from table1 {left | right} [outer] join table2 on predicate [join restriction]
For example:
select au_fname, au_lname, pub_name from authors left join publishers on authors.city = publishers.city