Expand my Community achievements bar.

SOLVED

Travel booking Count

Avatar

Level 2

Hey,

 

I have a scenario, that I am working on and kind of struck with that, any pointer will be appreciated.

 

  • Problem Statement: I have to fetch number of times a customer(count) have booked on same train, same day, same route.
  • Note: A customer can book multiple tickets on same train, same day, same route.

Output expected:

------------------------

Customer_id, Number_of_times_tickets_are_booked, train_number

 

Thanks in advance.

Sonika 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @SonikaDutta 

 

Assuming your bookings table has the informaton you have given and the cardinality from recipient is a 1:N.

The right way to do is group by train_number and do a count of your primary key.

 

If this is not the case,then please share the schema relationships.


     Manoj
     Find me on LinkedIn

View solution in original post

2 Replies

Avatar

Correct answer by
Community Advisor

Hello @SonikaDutta 

 

Assuming your bookings table has the informaton you have given and the cardinality from recipient is a 1:N.

The right way to do is group by train_number and do a count of your primary key.

 

If this is not the case,then please share the schema relationships.


     Manoj
     Find me on LinkedIn

Avatar

Administrator

Hi @SonikaDutta,

Were you able to resolve this query or do you still need more help here? Do let us know.

Thanks!



Sukrity Wadhwa