Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Server *= operator [duplicate]

I came across some code with this *= operator in a WHERE clause and I have only found one thing that described it as some sort of join operator for Sybase DB. It didn't really seem to apply. I thought it was some sort of bitwise thing (which I do not know much about) but it isn't contained in this reference at all.

When I change it to a normal = operator it doesn't change the result set at all.

The exact query looks like this:

select distinct 
       table1.char8_column1,
       table1.char8_column2,
       table2.char8_column3,
       table2.smallint_column
from   table1, table2
where  table1.char8_column1 *= table2.another_char8_column

Does anyone know of a reference for this or can shed some light on it? This is in SQL Server 2000.

like image 957
egerardus Avatar asked Aug 15 '13 16:08

egerardus


People also ask

What does *= mean in SQL?

That is the ANSI SQL 1989 syntax for RIGHT OUTER JOIN, where *= would be the LEFT OUTER JOIN. You should note also that putting the join syntax in the WHERE clause is deprecated in SQL 2008.

What does SELECT * from do?

An asterisk (" * ") can be used to specify that the query should return all columns of the queried tables. SELECT is the most complex statement in SQL, with optional keywords and clauses that include: The FROM clause, which indicates the table(s) to retrieve data from.

Can you use += in SQL?

+= (Addition Assignment) (Transact-SQL)Adds two numbers and sets a value to the result of the operation. For example, if a variable @x equals 35, then @x += 2 takes the original value of @x, add 2 and sets @x to that new value (37).

What does count (*) do in SQL?

COUNT(*) returns the number of items in a group. This includes NULL values and duplicates. COUNT(ALL expression) evaluates expression for each row in a group, and returns the number of nonnull values.


1 Answers

Kill the deprecated syntax if you can, but:

*= (LEFT JOIN)

=* (RIGHT JOIN)
like image 109
Hart CO Avatar answered Sep 28 '22 17:09

Hart CO