SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smile Which kind of table to make???

    Hi friends !
    I would like to display the following in a page:

    Present Month & year | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | ... & etc. till the end
    Variable 1 : x | y | z | xy| xx| xz|xc| xb | ... & etc. till the end
    Variable 2 : a | y | z | ay| ax| az|ac| ab | ... & etc. till the end
    Variable 3 : x | y | z | xy| xx| xz|xc| xb | ... & etc. till the end

    In place of month and year, it will be, say Dec 04, then the dates will come one after another. Means here I am creating a calender. Then there will be variables at the left, say they are three classmates. At last there will be x, y, etc. These will be integers - say- depending on what the variable classmates are doing everyday, they will be given marks by their teacher. In this page it should be like, the teacher will enter everyday this page to modify/change the marks - and yes, initially there will be certain figure at the place of x, y, etc.

    I am a bit confused about the table/tables that should I make in MySQL in order to get the said output. Should I go for only one table, or should I join multiple tables?

    Any help will be appreciated and helpful.
    Nice time to everybody.

  2. #2
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unhappy No reply?

    Hi friends!!!

    No reply yet ???????????????

    Am I not clear in my question !!!

    Cheers.

  3. #3
    SitePoint Addict pointbeing's Avatar
    Join Date
    Jun 2004
    Location
    London, UK
    Posts
    227
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello there -


    You may have more luck trying in the MySQL forum:

    http://www.sitepoint.com/forums/forumdisplay.php?f=182

    or perhaps in the general Database forum:

    http://www.sitepoint.com/forums/forumdisplay.php?f=88

    who knows, maybe a friendly moderator will move the thread there

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,017
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    yes, you are not clear in your question

    as far as storing the data is concerned, you probably want something like

    create table calendar
    ( variable varchar(9)
    , caldate date
    );

    but in order to get it to print sideways (all days of a given month on the same line), you would use your scripting language for that
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Thanks Pointbeing to move my question to the appropriate place.

    And the sql Guru, thanks for your reply. The problem that I am facing is to corelate three variables together. There are many days in a said month, then there are different people and each people will hold a different integer variable for each date.

    It is not that each day will hold one variable - this is easy. But that each day will have multiple variables (no. of people in the group) and that each of those variable will be attached to different individuals.

    I was wondering how to create a table / tables what can relate these three variable.

    Thanks for any reply.

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,017
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    three variables, three columns

    create table correlate3variables
    ( caldate date
    , person varchar(9)
    , variable integer
    );

    insert into correlate3variables values
    ('2004-12-11','curly',34)
    ,('2004-12-11','larry',46)
    ,('2004-12-11','moe',52)
    ,('2004-12-12','curly',5)
    ,('2004-12-12','larry',8)
    ,('2004-12-12','moe',1)
    ,('2004-12-13','curly',1003)
    ,('2004-12-13','larry',1423)
    ,('2004-12-13','moe',1742)
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  7. #7
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks a lot the SQL guru. So I have to repeat the same date again and again for each individuals. I thought about it and then it appeared to me repeatation might not be the best idea. And in fact I thought about some vertical horizontal solution. Like the dates could go horizontally and individuals' name vertically, to avoid repeatation. Anyway, I think I have to make a seperate table only for the individuals as their names would be updated at the beginning of every year - marks for each of them day by day will change, and maintained by the daily class teachers. And then I go for the table that you have suggested.

    Thanks again for the reply and your time, and don't hesitate to write again if by chance you find some other ideas.

    Thanks again. Cheers.

  8. #8
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,017
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    if for some reason you do try a "vertical horizontal" solution, be very, very careful, because the sql to return meaningful results will be a lot more complicated
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  9. #9
    Always learning kigoobe's Avatar
    Join Date
    May 2004
    Location
    Paris
    Posts
    1,563
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again for your answer. I will try what you have told during this weekend.

    Wish you a nice weekend.
    Cheers.


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
  •