Results 1 to 3 of 3

Thread: sum in a query

  1. #1
    Join Date
    Apr 2013

    Unanswered: sum in a query

    hi , i'm newbie here , i wanna ask ,
    i have travel database and a query in quey i have expression named sub_total , then i want to sum all of sub_total where id_booking like id_booking_detail but when i run that query, massage box show "circular circular reference caused by 'query_name' , sorry for my bad english

  2. #2
    Join Date
    Jan 2007
    Provided Answers: 10
    Open your query/queries and switch to SQL view.
    Post the code back here for all queries involved please.
    Home | Blog

  3. #3
    Join Date
    Apr 2013
    SELECT tbl_booking.id_booking,, tbl_booking.address, tbl_booking.no_telphone,, tbl_booking_detail.id_booking, tbl_booking_detail.id_destination, tbl_destination.[price], tbl_booking_detail.people, tbl_booking_detail.id_car, tbl_car.[kapacity(people)], tbl_car.[kapacity(item)], tbl_kind_of_car.car_price, tbl_booking_detail.number_of_car, tbl_booking_detail.schedule, [price]+[car_price] AS Sub
    FROM tbl_driver INNER JOIN (tbl_booking INNER JOIN ((tbl_kind_of_car INNER JOIN tbl_car ON tbl_kind_of_car.id_kind_of_car= tbl_car.kind_of_car) INNER JOIN (tbl_destination INNER JOIN (tbl_schedule INNER JOIN tbl_booking_detail ON tbl_schedule.id_schedule = tbl_booking_detail.schedule) ON tbl_destination.id_destination = tbl_booking_detail.id_destination) ON tbl_car.id_car = tbl_booking_detail.id_car) ON tbl_booking.id_booking = tbl_booking_detail.id_booking) ON tbl_driver.id_driver = tbl_booking_detail.id_driver, (Select SUM(sub) As Total from booking where [tbl_booking.id_booking]=[tbl_booking_detail.id_booking]) ;

    nb: booking is name of query ,sorry i have translating this database, because the original database using indonesian language
    Last edited by taikotoxdile; 04-10-13 at 10:35.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts