#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Location
    France
    Posts
    55
    Rep Power
    12

    dates manipulation


    Hello,

    I am developping an app for booking serveral stuffs.

    A "stuff" may be booked along several days :

    booking (stuff_id INT, start_time TIMESTAMP, end_time TIMESTAMP);

    But in the calendar i want to display booking per day.

    If I have this entry :

    Code:
    stuff_id | start_time              | end_time
    ----------+------------------------+------------------------
      1         | 2003-04-01 08:00 | 2003-04-03 18:00
    Can I get the result below using an SQL query?

    Code:
    stuff_id | start_time              | end_time
    ----------+------------------------+------------------------
      1         | 2003-04-01 08:00 | 2003-04-01 18:00
      1         | 2003-04-02 08:00 | 2003-04-02 18:00
      1         | 2003-04-03 08:00 | 2003-04-03 18:00
    Or should I use a plpgsql function? or something else?
    I'm using PostgreSQL 7.2.

    Thanx for the help!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Location
    France
    Posts
    55
    Rep Power
    12

    Re: dates manipulation


    Or should I use a plpgsql function? or something else?
    I'm using PostgreSQL 7.2.
    I have decided to upgrade to PostgreSQL 7.3.4 in order to be able to use a set returning function with the RETURN NEXT statement in plpgsql.

    Any other suggestion?

IMN logo majestic logo threadwatch logo seochat tools logo