I got this error message when I tried to run this code
select *
from Folio_Guest
where FolioID = (
select *
from Folio
where ArrivalDate between '20190101' and '20210901'
)
I got this error message when I tried to run this code
select *
from Folio_Guest
where FolioID = (
select *
from Folio
where ArrivalDate between '20190101' and '20210901'
)
The subquery needs to return at most one row and only one column. Perhaps you intend something like this:
select fg.*
from Folio_Guest fg
where fg.FolioID in (select f.folioID
from Folio f
where ArrivalDate between '20190101' and '20210901'
);
The important changes are:
folioID
.in
rather than =
so it can match multiple rows, if appropriate.