I have two tables in a DB, let's say one of the tables talks about services given by a hotel:
Table "Services"
- Hotel reference number
- Sauna
- Massage
- Spa
- Uva
The other table talks about availability:
Table "Availability"
- Hotel reference number
- week1
- week2
- week3
I wonder if it is possible to make a query that shows the reference numbers of all hotels having Sauna and Uva and being available week3.
To change tables is not a possibility.
Query inside query?
Moderator: General Moderators
joins
-
Hi,
it's possible to "connect" several tables with JOINS. Read about it on mysql.com or elsewhere existing tutorials.
djot
-
Hi,
it's possible to "connect" several tables with JOINS. Read about it on mysql.com or elsewhere existing tutorials.
djot
-
query example
-
Hi,
It looks like this, only one query:
djot
-
Hi,
It looks like this, only one query:
but there are several ways to do it, so study tutorials about all kind of joins (left, right, outer, inner and full joins) or you won't get good results nor good performance.SELECT * from db1,db2 WHERE (refno_db1=refno_db2 AND sauna='1' AND uva='1' AND week='3')
djot
-