how to retrive the data using asp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sonasiva
    New Member
    • Jan 2007
    • 15

    how to retrive the data using asp

    Dear all
    iam new for ASP

    I have data in database as like as follows

    Name company shares date
    A x 100 1/1/07
    A x 200 5/1/07
    A y 100 2/1/07
    A y 500 5/1/07


    I need to display as follows

    Name company shares date
    A x 200 5/1/07
    A y 500 5/1/07

    U can notice the latest updating for each name for all companies
    This is the output I should show in my web page
  • jhardman
    Recognized Expert Specialist
    • Jan 2007
    • 3405

    #2
    Originally posted by sonasiva

    I need to display as follows

    Name company shares date
    A x 200 5/1/07
    A y 500 5/1/07

    U can notice the latest updating for each name for all companies
    This is the output I should show in my web page
    so... your database potentially has multiple entries for each company, and you only want to display the most recent?

    I would sort the data by company, then date in reverse, then only display the first (most recent) entry for each company.

    query :
    "SELECT Name, company, shares, date FROM companyTable ORDER BY company, date DESC"

    Hmm. Syntax doesn't look quite right. I'll look it up if you want.

    Anyway, after you pull up one entry, skip ahead until you get to the next company, pull up one entry, skip ahead, etc.

    Comment

    Working...