PRB: Zero Rows Returned from SQL SELECT Statement (59461)



The information in this article applies to:

  • Microsoft SQL Server 4.2x
  • Microsoft SQL Server 6.0
  • Microsoft SQL Server 6.5
  • Microsoft SQL Server 7.0

This article was previously published under Q59461

SYMPTOMS

Executing the following SQL statement returns 0 (zero) rows:
   select t1.* from t1,t2
				

"t1" has key values of 1, 2, 3, and 4; "t2" is empty.

CAUSE

The above statement does not return any rows because when you specify two tables in the same SELECT statement without a WHERE qualifier, the result is a Cartesian product. However, a Cartesian product with one table empty is 0 rows. This is the same as multiplying any number by 0: the result is 0.

Modification Type:MinorLast Reviewed:2/14/2005
Keywords:kbother KB59461