vikingg97
asked on
Cant get a Count( * ) on INNER JOIN using OPENQUERY
I need to get the count(*) of an inner join statement using OPENQUERY using 2 linked queries. Is this possible? If so how?
Here is what I have, and keep coming up with an error.
SELECT * FROM
OpenQuery(AS400, 'SELECT SUBNO, PERNO, cgrpid FROM hmodta.hmembp') as a INNER JOIN
OpenQuery(WEBSRVR2, 'SELECT Count(*), External_System_Key, User_ID FROM mcnet..user_header') AS p ON a.SUBNO + a.PERNO = p.External_System_Key
WHERE a.cgrpid = 'M00005'
ORDER BY a.SUBNO DESC
Here is what I have, and keep coming up with an error.
SELECT * FROM
OpenQuery(AS400, 'SELECT SUBNO, PERNO, cgrpid FROM hmodta.hmembp') as a INNER JOIN
OpenQuery(WEBSRVR2, 'SELECT Count(*), External_System_Key, User_ID FROM mcnet..user_header') AS p ON a.SUBNO + a.PERNO = p.External_System_Key
WHERE a.cgrpid = 'M00005'
ORDER BY a.SUBNO DESC
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I am going to post another question related to this about how to include this into Classic ASP to return the record set, so if you guys know feel free to answer.
Thanks again!
vikingg97