简体   繁体   中英

To_char ,To_date

how do you become conform with this code, only dates of 2019 appear to me? You are not changing To_char.

SELECT GUEST.GNO, GUEST.GLASTNAME, GUEST.GFIRSTNAME, BOOKING.gNO, BOOKING.GINDATE 
FROM GUEST, BOOKING
WHERE GUEST.GNO = BOOKING.gNO AND BOOKING.GINDATE = TO_CHAR (GINDATE,'DD/MM/YYYY');

I am interpreting your query as you want bookings in 2019. If so, then query should look more like this:

SELECT g.GNO, g.GLASTNAME, g.GFIRSTNAME, b.gNO, b.GINDATE 
FROM GUEST g JOIN
     BOOKING b
     ON g.GNO = b.gNO 
WHERE b.GINDATE >= DATE '2019-01-01' AND
      b.GINDATE < DATE '2020-01-01';

Of course, there might be slight variations depending on your database.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM