SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2005
    Posts
    147
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Help With Select Query

    First of all the table and data:

    Time Date Name Result

    13:00 01 Jan 2010 Name01 Profit
    13:30 01 Jan 2010 Name02 Profit
    13:30 01 Jan 2010 Name02 Loss
    14:30 01 Jan 2010 Name03 Loss

    What I want to do is display these results, however for the record that is duplicated (Name02) I only want to show the 'Profit' row.

    So the query would end up with the following:

    13:00 01 Jan 2010 Name01 Profit
    13:30 01 Jan 2010 Name02 Profit
    14:30 01 Jan 2010 Name03 Loss

    The end result is to be displayed within a DataList (dont know if it can be omitted after the SQL query). Would appreciate any help.
    Turn My Text - ˇspuǝıɹɟ ʞooqǝɔɐɟ ɹnoʎ ǝzɐɯɐ puɐ ǝsnɟuoɔ

    Computer Game Cheats & Codes

  2. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,070
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Could you post that data again with column names and indicate where one column ends and the next starts please? Right now I don't really see what's what ...
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    Non-Member Kalon's Avatar
    Join Date
    Aug 2010
    Location
    At my computer
    Posts
    2,012
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think

    time column is 13:00, 13:30 etc

    date column is '01 Jan 2010'

    name column is 'Name01' etc

    result column is 'profit' or 'loss'


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
  •