Avatar of ckelsoe
ckelsoe
Flag for United States of America asked on

Compare query where ID's are different

Hi,

I need help with this query. It is to compare pre conversion data to post conversion data. recno = roid + 2000 (meaning that we added 2000 to the roid so the id's would not hit existing records in the target table.

Here is what I have so far:
SELECT
	`tpsmotorsports source`.`orders money`.recno AS recno,
	`tpsmotorsports target`.ledger.roid,        -- is recno + 2000
	`tpsmotorsports source`.`orders money`.taxamt,
	`tpsmotorsports target`.ledger.amount,
	`tpsmotorsports target`.ledger.transactiontype
FROM
	`tpsmotorsports source`.`orders money`
LEFT JOIN `tpsmotorsports target`.ledger ON `tpsmotorsports source`.`orders money`.recno = `tpsmotorsports target`.ledger.roid
WHERE
	transactiontype = 'RO - Taxes Owed'

Open in new window


For this to work I need to have the join factor in the 2000 increase in the roid value. For example recno 1 will be roid 2001. I am not clear on how to do this and what I have tried has failed. Any idea how to make this work?

Thanks,
c
MySQL ServerSQL

Avatar of undefined
Last Comment
ckelsoe

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
vr6r

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
ckelsoe

ASKER
I did and it returns 0 records. Then I realized I had added 2000 instead of subtract 2000. Another ID10t problem I think.

Thanks for the help!
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy