Question

I have the following two tables

enter image description here

I need to create a table that would summarize points for each date

enter image description here

How can I do this . I have updraded to Teradata 14 . And I am not quite familiar with all the new functions

Was it helpful?

Solution

If table1 is actually only a few rows you don't need any fancy query.

Assuming table1.caseid is a byteint this will result in a product join:

Select t2.datex, t2.caseid, sum(t1.points)
from table1 as t1 join table2 a t2 
on position(trim(t1.caseid) in t2.caseid) > 0
group by 1,2

Of course if this was a properly normalized table you could simple use a t1.caseid = t2.caseid join instead.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top