HOME > PHP > PHP Forum > จะให้ทำการค้นหาวันที่เริ่มต้น และวันที่สุดสิ้น ถ้าใช้ between ก็สามารถค้นหาได้ แต่ทำไมไม่สามารถค้นหาวันเดียวได้อะค่ะ รบกวนผู้รู้ด้วยค่ะ ด่วนจิงๆๆ
จะให้ทำการค้นหาวันที่เริ่มต้น และวันที่สุดสิ้น ถ้าใช้ between ก็สามารถค้นหาได้ แต่ทำไมไม่สามารถค้นหาวันเดียวได้อะค่ะ รบกวนผู้รู้ด้วยค่ะ ด่วนจิงๆๆ
select * from
(
SELECT ROW_NUMBER() OVER(ORDER BY payment_upd_dat desc) as rownum,
b.flight_booking_seq as flightBookingSeq,
booking_no as "bookingNo",
passenger_no as "passengerNo",
title+' '+first_name+' '+last_name as "bookName",
booking_status as "bookingStatus",
convert(varchar,booking_cre_dat,103) as "bookingCre",
booking_cre as "userCre",
card_app_code as "appCode",
convert(varchar,payment_upd_dat,103) as "paymentUpd" ,
payment_amt as "paymentAmt",
flight_no as "flightNo",
convert(varchar,flight_date,103) as "flightDate",
CASE payment_type
WHEN 'CW' THEN 'Payment Gate Way'
WHEN 'CC' THEN 'Credit Card'
WHEN 'AD' THEN 'Advance'
WHEN 'IC' THEN 'Internal Charge'
WHEN 'CA' THEN 'Cash'
WHEN 'TR' THEN 'Transfer'
ELSE payment_type
END as "paymentType",
invoice_no as "invoiceNo"
from ka_flight_booking b ,
ka_payment p,
ka_flight_itinerary i,
ka_flight_sche s
where p.flight_booking_seq = b.flight_booking_seq
and p.flight_booking_seq = i.flight_booking_seq
and i.flight_sche_seq = s.flight_sche_seq
and p.payment_upd_dat between '2011/06/01' and '2011/06/05'
) as TableUser
select * from
(
SELECT ROW_NUMBER() OVER(ORDER BY payment_upd_dat desc) as rownum,
b.flight_booking_seq as flightBookingSeq,
booking_no as "bookingNo",
passenger_no as "passengerNo",
title+' '+first_name+' '+last_name as "bookName",
booking_status as "bookingStatus",
convert(varchar,booking_cre_dat,103) as "bookingCre",
booking_cre as "userCre",
card_app_code as "appCode",
convert(varchar,payment_upd_dat,103) as "paymentUpd" ,
payment_amt as "paymentAmt",
flight_no as "flightNo",
convert(varchar,flight_date,103) as "flightDate",
CASE payment_type
WHEN 'CW' THEN 'Payment Gate Way'
WHEN 'CC' THEN 'Credit Card'
WHEN 'AD' THEN 'Advance'
WHEN 'IC' THEN 'Internal Charge'
WHEN 'CA' THEN 'Cash'
WHEN 'TR' THEN 'Transfer'
ELSE payment_type
END as "paymentType",
invoice_no as "invoiceNo"
from ka_flight_booking b ,
ka_payment p,
ka_flight_itinerary i,
ka_flight_sche s
where p.flight_booking_seq = b.flight_booking_seq
and p.flight_booking_seq = i.flight_booking_seq
and i.flight_sche_seq = s.flight_sche_seq
and p.payment_upd_dat between '2011/06/01' and '2011/06/01'
) as TableUser
จะไม่ขึ้นข้อมูลอะไรเลย ถ้าค้นหาวันเดียว ทำอย่างไรดีค่ะ
ช่วยแนะนำด้วย
Tag : MySQL, Ms SQL Server 2005, Ms SQL Server 2008, Oracle