Travel booking Count | Community
Skip to main content
New Participant
March 2, 2022
Solved

Travel booking Count

  • March 2, 2022
  • 2 replies
  • 1161 views

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 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by _Manoj_Kumar_

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.

2 replies

Sukrity_Wadhwa
Employee
March 17, 2022

Hi @sonikadutta,

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

Thanks!

Sukrity Wadhwa
_Manoj_Kumar_
_Manoj_Kumar_Accepted solution
New Participant
March 2, 2022

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