Hi, 1st post so hopefully you can assist me. I have a query called STCAGSENT, it returns the data I need, I now wish to pull a new data set, from a different source, and limit it so that ACCOUNT_NAME returns if it is the same as ACCOUNT_ID in the STCAGSENT report.
I tried this but its not right!
SELECT
ADMIN.ACCOUNT_NAME,
ADMIN.ACCOUNT_ID,
ADMIN.ORDER_ID,
ADMIN.DATE_RETURNED,
ADMIN.STATUS_CODE,
ADMIN.PART_CODE,
ADMIN.PRODUCT_NAME
FROM
ADMINXXXXXXXXXXXX
WHERE
ADMIN.ACCOUNT_NAME IN (STCAGSENT.ACCOUNT_ID)
Help Please..
Thanks
Mark
Does it cause an error? Or just zero results?
If it returns zero results - may it be due to the where clause....
ADMIN.ACCOUNT_NAME IN (STCAGSENT.ACCOUNT_ID)
rather than
ADMIN.ACCOUNT_ID IN (STCAGSENT.ACCOUNT_ID)
creates an Error, saying the STCAGSENT is not recognised.
is this microsoft SQL server issue? what is STCAGSENT ? you call it a report?
You're missing a join to the STCAGSENT table
try this
SELECT
ADMIN.ACCOUNT_NAME,
ADMIN.ACCOUNT_ID,
ADMIN.ORDER_ID,
ADMIN.DATE_RETURNED,
ADMIN.STATUS_CODE,
ADMIN.PART_CODE,
ADMIN.PRODUCT_NAME
FROM
ADMINXXXXXXXXXXXX
INNER JOIN STCAGSENT
ON ADMIN.ACCOUNT_ID=STCAGSENT.ACCOUNT_ID