Skip to main content
deleted 18 characters in body; edited tags
Source Link
Martin Lezer
  • 7.3k
  • 5
  • 27
  • 41

I have the following tables:

Table click and send

In the third table I want to combine these data with the SUM option in SQL so the total of clicks and Sends are in one field. Like this:

Output table

I created the following query:

SELECT 
SUM(s.Sends) as [Sends],
SUM(c.Click) as [Click],
s.JourneyName
FROM [Plus Tracking Journey Bounce] s
join [Plus Tracking Journey Click] c
on s.JourneyName = c.JourneyName
GROUP BY s.JourneyName, c.JourneyName

As a result I got this:

OUtput table2

It multiplies with 2 because there are two records in each table. I tried a different join but with no results. Is this even possible and if so, what do I miss.

Thanks a lot.

I have the following tables:

Table click and send

In the third table I want to combine these data with the SUM option in SQL so the total of clicks and Sends are in one field. Like this:

Output table

I created the following query:

SELECT 
SUM(s.Sends) as [Sends],
SUM(c.Click) as [Click],
s.JourneyName
FROM [Plus Tracking Journey Bounce] s
join [Plus Tracking Journey Click] c
on s.JourneyName = c.JourneyName
GROUP BY s.JourneyName, c.JourneyName

As a result I got this:

OUtput table2

It multiplies with 2 because there are two records in each table. I tried a different join but with no results. Is this even possible and if so, what do I miss.

Thanks a lot.

I have the following tables:

Table click and send

In the third table I want to combine these data with the SUM option in SQL so the total of clicks and Sends are in one field. Like this:

Output table

I created the following query:

SELECT 
SUM(s.Sends) as [Sends],
SUM(c.Click) as [Click],
s.JourneyName
FROM [Plus Tracking Journey Bounce] s
join [Plus Tracking Journey Click] c
on s.JourneyName = c.JourneyName
GROUP BY s.JourneyName, c.JourneyName

As a result I got this:

OUtput table2

It multiplies with 2 because there are two records in each table. I tried a different join but with no results. Is this even possible and if so, what do I miss.

Source Link
Martijn e
  • 143
  • 2
  • 10

SQL: How to get the right SUM of two different columns from two different data extensions into one new DE

I have the following tables:

Table click and send

In the third table I want to combine these data with the SUM option in SQL so the total of clicks and Sends are in one field. Like this:

Output table

I created the following query:

SELECT 
SUM(s.Sends) as [Sends],
SUM(c.Click) as [Click],
s.JourneyName
FROM [Plus Tracking Journey Bounce] s
join [Plus Tracking Journey Click] c
on s.JourneyName = c.JourneyName
GROUP BY s.JourneyName, c.JourneyName

As a result I got this:

OUtput table2

It multiplies with 2 because there are two records in each table. I tried a different join but with no results. Is this even possible and if so, what do I miss.

Thanks a lot.