Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

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.

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.

Avatar

Administrator

Hi @SonikaDutta,

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

Thanks!