Results 1 to 2 of 2

Thread: Min Function

  1. #1
    Join Date
    Aug 2004
    Posts
    77

    Unanswered: Min Function

    <%
    sql="select MIN(psprice)as askBA from transactions where namecompany='BA'and act='Limit sell order'"
    set AskBA=server.createobject("adodb.recordset")
    AskBA.open sql,conn,1,3%>
    <td height="22" width="41"><div align="center">
    <% if not(AskBA.eof) then
    response.write AskBA("askBA")
    else
    response.write "-"
    end if
    AskBA.close%>

    When there is Data which namecompany=BA and act=Limit sell order in table transactions , it's OK. It shows the minimun price.

    But the problem is that when there is no Data which namecompany=BA and act=Limit sell order in table transactions, it should show - But it does not show anything.
    I don't know why it does not go to condition Else.

  2. #2
    Join Date
    Apr 2002
    Location
    Germany
    Posts
    228
    that's because the min aggregate returns NULL when there are no rows for it, check for that instead of EOF

Posting Permissions

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