User Profile

Collapse

Profile Sidebar

Collapse
Charles Ndethi
Charles Ndethi
Last Activity: Apr 9 '11, 01:15 PM
Joined: Jan 24 '11
Location: Nairobi, Kenya.
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • How to set a session id to a value after using a case-when statement?

    Hi I want to set the session id to a value after evaluating the request_time using a case when statement.

    here 's the table
    Code:
    userinput_id         session_id          request_time               keyword
         1                                   2011-03-04 08:23:45        free    
         2                                   2011-03-04 08:25:50        free
    when the keyword is entered request_time...
    See more | Go to post

  • Thanks, I tried that plus I changed the order of assigning time to time(request_ti me) and i added a new parameter..it worked.see below:

    Code:
    delimiter //
    
    create procedure upd_userinput(in request_time TIMESTAMP,out time TIME, out user_session_id INT)     
    
    begin      
    
    set time = time(request_time);    
    
    case  
    when time < '09:15:00' && time > '08:15:00' then
    ...
    See more | Go to post

    Leave a comment:


  • I have but still i get error 1064..
    I cant see what's wrong with the procedure
    See more | Go to post

    Leave a comment:


  • How to use case-when statements in stored mysql procedure?

    Hi, I want to set the session_id automatically using the request_time parameter so i opted for a mysql stored procedure that contains a case statement.Here goes.

    Code:
    create procedure upd_userinput(in  request_time timestamp, out user_session_id int) 
    
    begin 
    
    update user_input;
    
    case request_time
    
    when time(request_time) < '9:15:00' && time(request_time) > '8:15:00'
    ...
    See more | Go to post

  • Is a where clause possible in show columns command?

    Hi,

    I want to return specific column titles based on a certain condition from the column's values:
    E.g

    in the table Employees:

    Code:
    EmployeeID  Monday   Tuesday   Wednesday
        1          1         0       0
        2          0         1       1
    The type of the days is BOOLEAN -- one represents present,
    zero absent,
    I want using the show...
    See more | Go to post

  • Ok.Thanks.
    Mysql does not support PIVOT/UNPIVOT.Therefo re i need to do a manual pivot using a union query you said?
    This means creating a pivot table?
    How should i go about this , for the table above ?
    See more | Go to post

    Leave a comment:


  • How to query Boolean columns to return ones with value 0?

    Hi,

    I want to query the table below as to return the titles of the column where the intersection of SessionId and Roomx is 0.The type of the Room is TINYINT - which in mysql represents BOOLEAN

    Below is the table:

    Code:
    SessionId    Room1    Room2    Room3
            1          0        1        0  
            2          1        0        1
    For the above table for example for SessionId...
    See more | Go to post

  • Thanks,
    I have left out a lot of detail because of how i intend to use the database. Good thing you work at a university so this may sound piece of cake ish.
    Heres is the problem for which i intend to use the database:

    In my institution there are several computer labs. These labs have classes e.g in lab1 there is C# programming, lab2 introduction to Unix e.t.c,

    When there are no classes in these labs,...
    See more | Go to post

    Leave a comment:


  • Charles Ndethi
    started a topic How to represent a timetable in a database?

    How to represent a timetable in a database?

    Hi,

    I want to represent a timetable on a mysql database.
    I had the idea that i should have three tables:
    1.a classdetails table- containing class capacity, classroom name e.t.c
    2.a class_sessions table with: start_time and end_time of session,
    3.a class_unit table with: the name of the course (MAT003. et.c)

    there would also be appropriate foreign keys in class_sessions table and class_unit...
    See more | Go to post

  • Charles Ndethi
    started a topic How to return name of free lab from query?

    How to return name of free lab from query?

    Here is sample pseudocode to capture the logic.
    Attached is the sql export.

    if ( lab_sessiontime .Start_time > NOW())
    then lab is free for Start_time - NOW() minutes
    _______________ _______________ _______________ _______________ ____

    else if (lab_sessiontim e.Start_time < NOW() )
    then check if ( NOW() > lab_sessiotime. End_time
    if true then lab has been free for [NOW() - End_time]...
    See more | Go to post
No activity results to display
Show More
Working...