Incorrect syntax near the keyword 'UNION'. "
HI,,
Please help me resolve this error.."All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists."
query:
Code:
sql = "SELECT EVENT_ID,EVENT_DATE,COMMENT FROM EVENTS WHERE CALL_ID=" & CallId & " UNION ALL SELECT A.USER_NAME from USERS A INNER JOIN EVENTS B ON A.USER_ID=B.USER_ID WHERE B.CALL_ID=" & CallId & ""
And am getting this error for the following query."Incorrect syntax near the keyword 'UNION'. "
query:
Code:
sql = "SELECT * FROM EVENTS WHERE CALL_ID=" & CallId & " ORDER BY EVENT_ID UNION ALL SELECT A.USER_NAME from USERS A INNER JOIN EVENTS B ON A.USER_ID=B.USER_ID WHERE B.CALL_ID=" & CallId & ""
Thanks...
Re: Incorrect syntax near the keyword Union
HI.. From this query what i am expecting is... I have to populate the Repeater list with values from two tables(EVENTS AND USERS).COLUMN NAMES from EVENTS I want to select are EVENT_ID,EVENT_DATE,COMMENT and from USERS i want to select USER_NAME WHERE EVENTS.USER_ID = USERS.USER_ID. and then i want to populate the repeater list with these values.How can i do this?
Query:
Code:
SELECT * FROM EVENTS WHERE CALL_ID=" & CallId & " ORDER BY EVENT_ID UNION ALL SELECT A.USER_NAME from USERS A INNER JOIN EVENTS B ON A.USER_ID=B.USER_ID WHERE B.CALL_ID=" & CallId & "
Thanks.