Re: Simple SQL Question
Usually, p I'm having a hard time relating the examples to my specific situation
The first method given is dead simple, a whole lot easier than trying to port SQL Server syntax to MySQL ...
select a.patent_id, group_concat(b.assignee_id)
from patent a
join assignee b using(patent_id)
group by a.patent_id;
Pivot tables are used to tabulate statistics for categories (years, months, departments &c) that are known before the query runs.
You're not aggregating, just tabulating, so if Group_Concat() is not a tidy enough solution for you, that is, you want separate column results, you'll need to query the assignee table in advance for the maximum no. of assignees a patent_id has, and write the query to return that many assignee columns.
Subject
Written By
Posted
Re: Simple SQL Question
August 27, 2017 05:00PM
September 07, 2017 02:38AM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.