SQL - does it work like this?! I'm a total SQL noob...

Post date: 2021-06-11 02:29:35
Views: 137
Basically I'm trying to update some records in our EPOS database because the transactions relate to last month but they've been input for this month. There's about 25 of them so I thought rather than manually doing them one by one in SQL Workbench and possibly making mistakes I'd try to learn how to do it more automatically. THANK YOU

I get the feeling this is easy for SQL, perhaps its bread and butter, but I'm totally new to it... I'm wanting to query table CUST_TRAN and find out the 'ID' for value $1 which is in column 'INVOICE'. I then want to use this newly discovered 'ID' to update table 'TRANSACTS' to change the DATE and DATE_TIME (two values in two columns) to value $2 using the column IDFROMTRAN to match the ID against...there are often TWO rows with the same IDFROMTRAN that need backdating because the customer signs for the goods and the act of signing creates its own row in the db.

Does any of this make sense?!

Basically to explain what I'm doing I'm changing the date on transactions to put them into last month so that they'll be invoiced correctly and reflect when the customer was actually in store.

TLDR: How do I find out an alternative ID for a transaction then use that to change the date in two rows in another table? Thank you!

Does it have to be done in stages or can it be done as one transaction for each query?
Number of Comments
Please click Here to read the full story.
 
Other Top and Latest Questions:
Trump condemns racist video showing Obamas as apes after removing it, but says he won't apologize
I've studied over 200 kids—the happiest ones have parents who do 6 things with them before bedtime
Top Wall Street analysts like these stocks for long-term growth potential
Hims & Hers pulls copycat weight-loss pill after threats of legal action
NFL plans to have discussions with partners outside of core media for live games, media chief says
Tech giants in China sold off alongside their U.S. peers last week. How to play it
Japanese Prime Minister Takaichi's ruling LDP set to secure supermajority in Lower House: NHK
Kroger to name former Walmart exec Greg Foran as next CEO, WSJ reports
Japan's Nikkei 225 skyrockets over 5% to hit record highs as Takaichi secures historic mandate
Epstein files: Congressional lawmakers call for Trump Commerce chief Lutnick to resign, or be fired