I did the sql coding but im not sure if that is the correct way to do it

can someone tell me if this is the correct sql coding that i did, im not sure if that is the way i do it

what kind of report will be required for one particular hotel? write at least one SELECT statement (queries) per report need to write at least two statement and report but i did one im not sure if that is the correct for one of it can someone help me with this please

SELECT room.type, room.price FROM Room
WHERE hotelname
INNER JOIN Room ON Hotel.hotelNO=Room.hotelNo AND hotelName='Hilton

I guess 'Hilton is really ā€˜Hiltonā€™ (the last quote is not there, probably a bad copy)

Iā€™m sure that you can Google the structure of a SELECT query and compare an example from any book to your own query.

SELECT table1.fieldname1, table1.fieldname2, table2.fieldname1ā€¦

FROM table1 INNER JOIN table2 on table2.table1id=table1.table1id

WHERE ā€¦

You get the idea

1 Like

i tryed everything but couldnt get it right at all

Look at your query and look at the order I showed you. Do you see any difference between your query and the right order for a SELECT query? HINT: INNER JOIN is part of the FROM clause

SELECT h.hotelname, r.roomno, r.price
FROM b.roomNO
INNER JOIN b.booking ON b.roomNo = b.roomNO
WHERE hotelname= ā€˜Hiltonā€™

do you think this is the correct one

[quote=ā€œSevim_WebDesign, post:5, topic:187441, full:trueā€]do you think this is the correct one
[/quote]
what happened when you tested it?ā„¢

Off Topic:

why the TM thing if you donā€™t mind my asking?

see Does this work (update + in ) - #11 by r937

I see :smile:

@Sevim_WebDesign

I think that you suspect by now that your query is wrong.

Remember that you donā€™t use the name of a field right after FROM. It should be a table. Same right after the INNER JOIN part

Also, it looks like youā€™re using three tables but you have only created one relationship: table b with itself.

[quote=ā€œmolona, post:9, topic:187441, full:trueā€]Also, it looks like youā€™re using three tables but you have only created one relationship: table b with itself.
[/quote]
he/she is obviously cutting and pasting from somewhere else (edit: and it isnā€™t here at sitepoint, see Help finding the total income from a booking for a given hotel date - #14 by molona), and hasnā€™t answered my question (i wouldā€™ve pointed out how the error message relates to the query, to teach him/her how to debug)

but when i get no cooperation, and instead guesswork, i sense a student hard up against a deadline with no real interest in learningā€¦

ā€¦ and thatā€™s when i bail

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.