Question: I have a customers table and an orders table. I want to display the customer and all of his/her order dates on one row, rather than multiple rows. Here is what I have and what I'm looking for:

![Picture of both tables, current results, what i'm looking for](https://i.stack.imgur.com/IQclF.png)

Basic code to get results:

```
select customerid, name, orderdate
from customer_table c inner join
     order_table o
     on c.customerid = o.customerid 

```

Answer: 
this will work at the most you cant show it on different columns having nulls:

```
select customer_id,name,LISTAGG(orderdate, ', ') WITHIN GROUP (ORDER BY orderdate) 
from(select customerid, name, orderdate
from customer_table c inner join
order_table o
on c.customerid = o.customerid );

```
first create a view like this:

```
create view order_view as 
select 
count(*) over (partition by customerId order by orderDate) as ord,
CustomerId,
orderdate
 from order_table 

```

then you can use this query:

```
 select c.customerid, 
 o1.orderdate,
 o2.orderdate
 o3.orderdate
 .
 .
 .
 o12.orderdate
from customer_table c 
left join  order_view  o1
     on c.customerid = o1.customerid and ord = 1 
left join  order_view  o2
     on c.customerid = o2.customerid and ord = 2 
left join  order_view  o3
     on c.customerid = o3.customerid and ord = 3
.
.
.     
left join  order_view  o12
     on c.customerid = o12.customerid and ord = 12

```