Results 1 to 7 of 7

Thread: variable side by side

  1. #1
    Join Date
    Dec 2003
    Location
    turkey
    Posts
    4

    variable side by side

    I am from turkey. I prepared one project
    but I couldn't finished yet.Because I have problems
    end of the project.I couldn't solve this problem.I
    wrote a lot of forums about mysql,php but no
    solution.My english is bad.Excuse me For writing my mistakes.

    I can't change database design.
    I want to see view output
    year and values but values side by side for variables.
    Selected is getting from html page for variables.
    Only variables selected.


    I try on explain my problem a sample.
    the file is attached with excel worksheet for your
    information.
    Please can you look at this file and give me your
    advice.
    thanks for your coorparation
    Attached Files Attached Files

  2. #2
    Join Date
    Dec 2002
    Location
    Cape Town, South Africa
    Posts
    75
    Hi

    I'm not quite sure what you mean. Can you explain some more?

  3. #3
    Join Date
    Dec 2003
    Location
    turkey
    Posts
    4
    my table is item which has four columns(it_id int,year date,definition varchar,value varchar myisam),150000 rows.
    another sample;
    it_id,year,definition,value
    -----,----,------,-----
    10,1998,asder,4578
    10,2000,derse,56987
    10,2001,dersen,7899
    10,2002,versen,8899
    10,2003,keren,7899
    11,1999,sanal,56
    11,2001,kanal,78
    13,2001,buras,111
    ....
    I can't change database design.
    I want to see view output
    year and value but values side by side for it_id.


    forexample(selected it_id=10 and it_id=11 from user, could'nt select dates,always all date selected)

    I want to see view output

    year,val_10,val_11
    ----,------,------
    1998,4578,null
    1999,null,56
    2000,56987,null
    2001,7899,78
    2002,8899,null
    2003,7899,null

    What can I do,How can.?
    thanks for help.

  4. #4
    Join Date
    Dec 2002
    Location
    Cape Town, South Africa
    Posts
    75
    This looks like you need help with HTML, MySQL and whatever scripting language you're using (PHP, perl etc). That's a bit too general to answer, but take a look at some of the articles on www.databasejournal.com, www.wdvl.com, www.sitepoint.com, www.mysql.com and www.php.com etc to get started - there are lots of newbie resources out there, and Google will help you find most of them. Good luck!

  5. #5
    Join Date
    Dec 2003
    Location
    turkey
    Posts
    4
    Hi,
    I used html,mysql,php for design web page.
    Before I wrote this problem, I searched lots of web page,forum about Mysql,php,html.But I haven't solved it.
    So I decide to write you.Do you have any idea or script.

    Best regards.

  6. #6
    Join Date
    Dec 2003
    Location
    Istanbul, my love
    Posts
    1
    selam erdem

    i had such a problem years ago, i have solved it using sql functions and calling those functions in select query..
    but i did it on Postgresql, so i am not sure it is fully compatible with mysql, anyway at least it gives you an idea..

    this is what i would do on postgres--

    create sql functions that returns the value of given year.. get_value(year, it_id)

    ex:
    create function get_value( varchar, int) returns
    varchar as 'select value from table where year=''$1'' it_id=''$2'' ' language 'sql';

    and run this query..

    select year, get_value(year, 10), get_value(year, 11) from table group by year ;
    i think it gives you

    1998 value_10 value_11
    2000 value_10 value_11


    try mysql equivalent of this, i hope it works..

  7. #7
    Join Date
    Dec 2003
    Location
    turkey
    Posts
    4
    hi xjimmor ;


    Your suggestions is fine but I haven't done beacuse I couldn't write funcions in mysql.

    I haven't solved this problem.Do anybody have any idea about problem.

    best regards

Posting Permissions

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