SQL UPDATE JOIN to another table Teradata
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
My Teradata SQL has a volatile query that I was able to mimic in Alteryx. I am having trouble UPDATING the data using information from another table. I can join OK, but not sure how to make sure the date range in join from DATA_Orig (previously my volatile table) is withn the NewDataUpdate date range nor how to restrict in the join to UPDATE only those that have a rating and are not in CA:
UPDATE DATA_Orig FROM NewDataUpdate ND SET Rating = ND.Rating WHERE Provider = ND.Provider AND ST_CDE = ND.State AND serviced_dte BETWEEN ND.eff_dt AND ND.end_dt AND St_CDE NOT IN ( 'CA') AND ND.Rating <> 0 ;
I tried joining then removing cartesian product via dates but that did not work and did not seem efficient. This is my first community question and I am hoping question clear enought. Thanks in advance.
Solved! Go to Solution.
- Labels:
- Best Practices
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Here are the steps to solve your issue:
1. Add all of your SQL including the updates that you are performing in the Pre SQL Statement under options.
2. Under Table or Query add your SELECT statement.
3. Continue with your workflow based on the data retrieved in step # 2.
Best Regards,
ccasijr
