Skip to main content
Level 2
Mar 2, 2022 12:43 PM UTC
Solved

Travel booking Count

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.
Manoj_Kumar
Manoj_KumarAccepted solution
Community Advisor
Mar 2, 2022 12:48 PM UTC

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  | https://themartech.pro

2 replies

Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
Mar 2, 2022 12:48 PM UTC

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.

Translate
Manoj  | https://themartech.pro
Sukrity_Wadhwa
Level 4
Mar 17, 2022 5:52 AM UTC

Hi @sonikadutta,

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

Thanks!

Translate
Sukrity Wadhwa