Thank You
for the help, I probably gave a wrong example, so let's try again:
SQL = "SELECT COUNT(*) AS UNACT_SUPP FROM TABLE_SUPPLIER WHERE C_TYPE = 'FAX'"
SQL = "SELECT COUNT(*) AS ACT_SUPP FROM TABLE_SUPPLIER WHERE ACTIVE = 1"
As you can see I want to different values not in any way united togather.
What I need is to get UNACT_SUPP and ACT_SUPP values.
Any ideas ?
SELECT
(SELECT COUNT(*) FROM TABLE_SUPPLIER WHERE C_TYPE = 'FAX'") AS UNACT_SUPP,
(SELECT COUNT(*) FROM TABLE_SUPPLIER WHERE ACTIVE = 1") AS ACT_SUPP
[TCX][MyODBC]You have an error in your SQL syntax near 'SELECT COUNT(*) FROM TABLE_SUPPLIER WHERE C_TYPE = 'FAX') AS UNACT_SUPP, (SELECT' at line 1
/test.asp, line 13
The code I use is:
SQL = SQL & "SELECT "
SQL = SQL & "(SELECT COUNT(*) FROM TABLE_SUPPLIER WHERE C_TYPE = 'FAX') AS UNACT_SUPP,"
SQL = SQL & " (SELECT COUNT(*) FROM TABLE_SUPPLIER WHERE ACTIVE = 1) AS ACT_SUPP"
Once agin:
If I execute the SQL_1 separetly it returns 35
and SQL_2 returns 1, but when I use UNION it returns nothing. It doesn't even find anything.
Example:
SQL_1 = "SELECT COUNT(*) AS ACTIVE_LINKS FROM TABLE_LINK WHERE ACTIVE = 1"
SQL_2 = "SELECT COUNT(*) AS UN_LINKS FROM TABLE_LINK WHERE ACTIVE = 0"
SQL = SQL_1 & " UNION " & SQL_2
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.