-1

Let say I have student Table like below in BigQuery:

Student Table

Mark Table looks like below in Big Query:

mark table

I would like to join this two tables and create a new table like below :

enter image description here

Musa
  • 87
  • 8

1 Answers1

1

Consider below query,

SELECT s.*, m.Mark_Details
  FROM student_table s
  JOIN (
    SELECT student_ID,
           STRING_AGG('' || Subject_ID || ':' || Subject_Name || ':' || Mark, ' | ') AS Mark_Details
      FROM mark_table
     GROUP BY 1
  ) m USING (student_ID)
Jaytiger
  • 11,626
  • 2
  • 5
  • 15