Found 24th Feb 2010
Hi there,

I am having problems with the MYSQL Command Line client on my computer and was wondering if you think these queries will work. Assuming that correct tables and data have been inputted.

This should select the average length of time someone stays at a hotel at any one time:

SELECT [Hotel Name], AVG(DATEDIFF ( "y" , FORMAT ( [Date of Arrival], "DD/MM/YYYY") , FORMAT ( [Date of departure], "DD/MM/YYYY") )) AS [Average Days]
FROM Booking_details
GROUP BY [Hotel Name]

Thanks. I'm unsure if the Square brackets are required?

  1. Misc
Groups
  1. Misc
6 Comments

Banned

dude there is a MySQL forum. use that. or read your SQL books and that way you'll learn

bykergrove;7938754

dude there is a MySQL forum. use that. or read your SQL books and that … dude there is a MySQL forum. use that. or read your SQL books and that way you'll learn



may i recommend SQL for dummies.....

ALT + F4 works for me

SELECT Hotel Name, AVG(DATEDIFF ( "y" , FORMAT ( Date of Arrival, "DD/MM/YYYY") , FORMAT ( Date of departure, "DD/MM/YYYY") AS Average Days
FROM Booking_details
GROUP BY Hotel Name

Try that, you had too many end brackets and delete the square ones.

As all the others has said, you're probably better off asking on a sql forum as you'll get more advice.

Babbabooey;7938785

So many SQL threads, so little time. … So many SQL threads, so little time. :roll:http://www.hotukdeals.com/search?user_id=100317&user_search=SAVE4IT&user_search_type=posts&threads_with=minimum&posts_from_option=newer&sort_results_by=Last+Posting+Date&sort_results_option=DESC&advanced_search=Search+Now



was just looking at that myslef...

maybe for the OP we should rename the site HUKSQL:p
Post a comment
Avatar
@
    Text
    Top Discussions
    1. EA shuts down Visceral Games.56
    2. word association Game74244871
    3. 5 Letter Scrabble Game52322826
    4. Misco about to go into administration912

    See more discussions