اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

نتائج SQL خاطئة


Osama Boshi

الردود الموصى بها

السادة الاعضاء الاعزاء

السلام عليكم و رحمة الله و بركاته

عندي جدول مؤلف من حقلين time_start و time_end

و قد ادخلت في هذا الجدول 6 حجوزات

1- 29/09/2010 - 03/10/2010

2- 29/09/2010 - 07/10/2010

3- 22/09/2010 - 02/10/2010

4- 22/09/2010 - 08/10/2010

5- 20/09/2010 - 25/09/2010

6- 02/10/2010 - 08/10/2010

\-------------------------------------

SELECT * FROM booking

where

time_start < date() and time_end > date()

and

(

time_start > start and time_end < end or

time_start > start and time_end > end or

time_start < start and time_end < end or

time_start < start and time_end > end

)

\------------------------------------

و عند تنفيذ الاستعلام اقوم بادخال القيم التالية

start=15/09/2010 &&& end=26/09/2010

تظهر نتائج بشكل صحيح

و لكن في حالتين فقط تظهر النتائج خطأ

1- اذا كانت start<date && end<date

مثلا start=20/09/2010 &&& end=25/09/2010

2- اذا كانت start > date && end > date

مثلا start=03/10/2010 &&& end=10/10/2010

و هذا خطأ لانه متعارض مع الشرط الاول

time_start < date and time_end > date

ارجو المساعدة في ايجاد الحل

و شكرا

test_time.zip

تم تعديل بواسطه Osama Boshi
رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information