Need Help understanding *= joins
Unfortunately the date is not in the H but rather G
May 25th, 2012 8:03am
Free fall :)
Table Join Syntax
Outer joins are supported in Sybase using the =* (right outer join) and *= (left outer join) operators:
SELECT customer_name, order_date FROM customers, orders WHERE
customers.cust_id =* orders.cust_id
For all rows in the customers table that have no matching rows in the orders table, Sybase returns NULL for any select list expressions containing columns from the orders table.
SQLServer uses ANSI standard syntax for outer joins.
SELECT publishers.pub_id, titles.title, titles.title_id
FROM titles RIGHT OUTER JOIN publishers
ON publishers.pub_id = titles.pub_id
Senior BI Consultant & PM @
Bicentrix
If it is, Please dont forget to mark as answered or at least vote as helpful if the post helps you in any ways.
Free Windows Admin Tool Kit Click here and download it now
May 25th, 2012 8:33am
Thanks for clearing this up for me
The issue with my query above was that DBO.G should be in the place of DBO.H and vice versa
Thanks for all the help guys :)
May 25th, 2012 9:42am
Good Morning,
Im transferring queries written in Sybase into SQL,
One query is written as such with *= on as the joins:
select a,b,c,d,e,f
from dba.G, dba.H, dba.I
where date between '2012-05-12' and '2012-05-18'
and jdt_job_locator *= job_locator
and locator *= ser_locator
the result is 24000+ rows which is correct
when i transfer the query into SQL this is what i have written:
select a, b, c, d, e, f,
from dbo.G
Left join dbo.H on jdt_job_locator = job_locator
Left join dbo.I on locator = ser_locator
where date between '2012-05-12' and '2012-05-18'
but i get 16000 rows which is a full 8000+ out
when i remove the *= from the original query i get the same 16000 as i do from the sql query
Any ideas what the *= are doing???
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2012 7:23am
The date column in your where clause must be in one of the left joined tables? If that is the case then
date between '2012-05-12' and
'2012-05-18'
Needs to be added to the join logic.
If you aliased your filed names then we could tell which table they were coming from.
The query should probabally be this (assuming date is in dbo.H
select a, b, c, d, e, f,
from dbo.G
Left join dbo.H on jdt_job_locator = job_locator
and date between '2012-05-12' and '2012-05-18'
Left join dbo.I on locator = ser_locator
Chuck Pedretti | Magenic North Region | magenic.com
May 26th, 2012 7:29am


