FIX: SELECT ... UNION Produces Unexpected Output

ID: Q109581

2.5x 2.60 | 2.5x 2.60 | 2.50b

WINDOWS   | MS-DOS    | MACINTOSH
kbprg kbbuglist kbfixlist

The information in this article applies to:

SYMPTOMS

The UNION clause of the SELECT statement can cause unexpected output under certain circumstances.

STATUS

Microsoft has confirmed this to be a problem in the products listed at the beginning of this article. This problem was corrected in FoxPro version 2.6a for MS-DOS and FoxPro version 2.6a for Windows.

MORE INFORMATION

Steps to Reproduce Problem

Executing the following code will demonstrate this problem:

  CREATE TABLE test1 (one c(1), two c(1), three c(1))
  INSERT INTO test1 VALUES ('a','b','c')

  CREATE TABLE test2 (one c(1), two c(1), three c(1))
  INSERT INTO test2 VALUES ('a','b','c')

  * Notice the output produced by this SELECT statement, which includes
  * the clause "UNION ALL".

  SELECT one,two,three FROM test1 UNION ALL ;
  SELECT one,one,three FROM test2 TO SCREEN

     ONE TWO THREE
     a   b   c
     a   a   c

  * Notice the output produced by this SELECT statement, which includes
  * the clause "UNION". It is different from the output produced by the
  * previous SELECT statement, which includes the clause "UNION ALL".

  SELECT one,two,three FROM test1 UNION ;
  SELECT one,one,three FROM test2 TO SCREEN

     TWO_A TWO_B THREE
     a     a     c
     b     b     c

Additional reference words: FoxMac FoxDos FoxWin 2.50 2.50a 2.50b sql server windows nt union buglist2.50 buglist2.50a buglist2.50b buglist2.60 fixlist2.60a KBCategory: kbprg kbfixlist kbbuglist KBSubcategory: FxprgSql
Keywords          : FxprgSql kbbuglist kbfixlist
Version           : 2.5x 2.60 | 2.5x 2.60 | 2.50b
Platform          : MACINTOSH MS-DOS WINDOWS
Solution Type     : kbfix

Last Reviewed: October 16, 1997