Simple SQL syntax question

Results 1 to 2 of 2

Thread: Simple SQL syntax question

  1. #1
    Blank Guest

    Default Simple SQL syntax question

    I need to grab records from a db based on a date selected from a popup. The popup passes the year as 2/11/2001 but I have a whole whack of data that is formatted as 2/11/01<BR>I need a SQL query that pulls both but my wildcard isn&#039;t working (the field name is SubmitDate and the form field name they are entering into is DateEntered). How can I get both 2/11/2001 and 2/11/01. I have <BR>SQL = "Select ADVISORREQUESTS.*,COORDINATORREQUESTS.* FROM ADVISORREQUESTS,COORDINATORREQUESTS WHERE ADVISORREQUESTS.SubmitDate Like &#039;%"& Request("DateEntered") &"&#039; AND COORDINATORREQUESTS.SubmitDate Like &#039;%"& Request("DateEntered") &"&#039; AND COORDINATORREQUESTS.Approved = &#039;Pending&#039; AND ADVISORREQUESTS.Approved = &#039;Pending&#039; ORDER BY COORDINATORREQUESTS.RecordID, ADVISORREQUESTS.RecordID, COORDINATORREQUESTS.Skill, ADVISORREQUESTS.Skill" <BR>Thanks.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Simple SQL syntax question

    Try taking the date entered and using that string to create the other date format, then use the two strings in the SQL statement<BR><BR>E.g. if 2/11/2001 is entered then call this (e.g.) strDateA<BR><BR>Then Create a second String Call (e.g.) strDateB which would = 2/11/01<BR><BR>To do this use something like the method "Right(string, length)" to check the first variable and then create second from this...<BR><BR>(I will try and get some code for you as it is not easy to explain or to do without trying it myself first!)

Posting Permissions

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