SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Wizard donboe's Avatar
    Join Date
    Jun 2010
    Location
    Netherlands
    Posts
    2,107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    WHERE date ?????

    I need a query for populating a activity/participant list for printing. The list is feeded by two url variables:

    activity_id and activity_date

    The format (through my serverside scripting) for the activity_date in the drop down is:

    dd mmm, yyyy

    I only have know idea how to translate the Url.dateformat in to the right format in the where clause in my query. This is what I have so far:
    Code MySQL:
     
      SELECT
              AL.activity_id
            , AL.activity_name_home_language
            , AD.activity_date
            , AP.bookings_number
            , P.persons
            , COUNT(persons) AS total_persons
            , P.first_name
            , P.last_name
            , P.telephone
      FROM
              activity_list AL
      INNER
        JOIN  activity_dates AD
          ON  AL.activity_id = AD.activity_id
      INNER
        JOIN  activity_participants AP
          ON  AL.activity_id = AP.activity_id    
      INNER
        JOIN  participants P
          ON  AP.participant_id = AD.participant_id 
      WHERE
              AL.activity_id = 'Url.activity_id'
      AND
              AD.activity_date = ?????
    What would be the right format?
    “Good artists copy, great artists steal” (Pablo Picasso - 1934)

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,270
    Mentioned
    60 Post(s)
    Tagged
    3 Thread(s)
    since this is mysql, you should use the STR_TO_DATE function
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

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