Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    Kuwait
    Posts
    4

    Unanswered: Simple Max row not retrieved

    Hi guys

    I am trying to retrieve a row of data where I am matching a foreign key and trying to get the max ID for that criteria. I get the message that the query has complete successfully but i am not getting any data.

    Simple Database Structure
    ID, PortID, Amount, Balance

    Query
    select * from t_portfolio_cash
    where PortID = 32
    having max(ID)

    I played around and just retrieve the Max(ID) and that worked fine
    Query
    Select Max(ID) t_portfolio_cash
    where PortID = 32

    I don't understand what i am doing wrong. I really need to retrieve the entire row.

    Thanks in advance

  2. #2
    Join Date
    Mar 2004
    Posts
    480

    Re: Simple Max row not retrieved

    select * from t_portfolio_cash
    where PortID = 32
    order by ID desc
    limit 1;

  3. #3
    Join Date
    Mar 2004
    Location
    Kuwait
    Posts
    4

    Re: Simple Max row not retrieved

    Thanks for your help, that works fine

Posting Permissions

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