Advanced SQL Help

Results 1 to 2 of 2

Thread: Advanced SQL Help

  1. #1
    Jon Guest

    Default Advanced SQL Help

    I am trying to create a schedule that does not allow the user to add a show when one already exists at a certain time and date. The database contains a Program Start Date and Time and a Program End Date and Time. I am trying to write a sql statement that will allow me to input my new show start and end dates and times and see if there is one already in the database for that date and time. Can anyone help me?

  2. #2
    SPG Guest

    Default RE: Advanced SQL Help

    Well, there&#039s a long way and a short way. I don&#039t like the long way, so you get the short way.<BR><BR>myStart, myEnd, dStart, dEnd -- 2 variables, 2 columns.<BR><BR>(myStart between dStart and dEnd) or<BR>(myEnd between dStart and dEnd) or<BR>((dStart between myStart and myEnd) and (dEnd between myStart and myEnd))<BR><BR>So if either your beginning or end is between an existing beginning or end OR the a complete existing event is in your event time, that SQL condition will pick it up.<BR><BR>the "Between" literally translates to <BR>((lowValue &#060;= input) and (input &#060;= highValue))<BR>and is part of the SQL-92 language standard.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts