ASE now supports 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, in which 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 and price > 15
Outer joins, in which 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_namefrom authors left join publisherson authors.city = publishers.city
For more information see the Transact-SQL User’s Guide.