Home > Software engineering >  In VB6.0 by use of different SQL version returns the problem
In VB6.0 by use of different SQL version returns the problem

Time:10-07

Suppose you have two tables, respectively is A table and B table, A table with two columns, A1, A2, B table has 2 A2, B1, A four columns, B two columns
I query need to have A table
Select a. *, isnull (b.b Check, 0) bCheck
From A
Left the join (select 2, b.A bCheck=1 from B) as on b.A 2 B=A.A 2
Such a query statements, in SQL2000 and 2008 results are consistent, bcheck that a list of all is the result of 0,1,1,0
But I return the result obtained in VB6.0 by use of time, is different, when the database is 2000 is normal, database in return for 2008, bcheck that a list of all is the result of 1,1,1,1, VB with the ADODB connection
Consult, why the results, and how to solve

CodePudding user response:

Will try bCheck=1 to 1 As bCheck,
The latter is conform to the SQL standard,

CodePudding user response:

reference 1st floor Tiger_Zhao response:
to bCheck=1 to 1 As bCheck a try,
The latter corresponds to the SQL specification,

Tried, the effect is no change,
I changed a written
Select a. *, bcheck=(case when b.A 2 is null then 0 else 1 end) bcheck
From A
Left the join on b.A 2 b=A.A 2
After this, the effect is, of the error can be avoided, in front of the cause of the error or don't understand

CodePudding user response:

SQL command is the string to the database engine, your SQL syntax must be compatible with the current version of the database engine, and enable it to properly parse,

Different database engine, and even different versions, supported by the internal command or format may be different,

CodePudding user response:

Different database engine, and even different versions, supported by the internal function or format may be different,
  • Related