Techiio-author
Started by Chris GillNov 5, 2021

Open
query MySQL should return only unbooked

1 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 1 VIEWES SHARE

I were given three tables

Lakes - identification,name,lat,lon

Pegs - id, pegnumber, pegname,lake_id

Reservations- identity, start_day,end_day , peg_id

I am attempting to write the question who return me the listing of unbooked pegs on a lake at some point or among two dates. I wrote that query however they return me best already booked.

SELECT l.name,p.id,p.peg_number,r.start_day,r.end_day     
FROM reservations r 
left join pegs  p on r.peg_id = p.id 
left join lakes l on p.lake_id = l.id
WHERE r.start_day is not null 
order by l.name

0 Replies

You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance