By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,779 Members | 1,291 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,779 IT Pros & Developers. It's quick & easy.

my query it's right ?

100+
P: 132
hi,

i have this scénario :
If request bookings with the following parameters: from = 2009-06-19T08:00:00, to = 2009-06-19T09:00:00
 The distribution system application must return booking B1 with a status = Create
If request bookings with the following parameters: from = 2009-06-19T09 :30 :00, to = 2009-06-19T09 :40 :00
 The distribution system application must return no booking
If request bookings with the following parameters: from = 2009-06-19T09 :50 :00, to = 2009-06-19T10 :10 :00
If request bookings with the following parameters: from = 2009-06-19T10 :20 :00, to = 2009-06-19T11 :00 :00
 The distribution system application must return booking B2 with a status = Cancel

and i want to translation in code Mysql i do that
Expand|Select|Wrap|Line Numbers
  1. select REPLACE(arrival, ' ', 'T') as arrival, REPLACE(departure, ' ', 'T') as departure , case
  2.                         when departure = '2009-06-19 09:00:00' and arrival= '2009-06-19 08:00:00' then 'create'
  3.                         when departure > '2009-06-19 09:00:00' and arrival> '2009-06-19 08:00:00' then 'no booking'
  4.                             when departure > '2009-06-19 09:00:00' and arrival> '2009-06-19 08:00:00' then 'cancel' end as action
  5.  
  6.                         from jo_jomres_contracts
:
it's true or false because i want the time inclusion .

Thanks in advance
Jul 17 '13 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.