<p>I am using sybase database to query the daily transaction report. I had subquery within my script. </p>

<p>Here as it goes:</p>

<pre><code>SELECT orders.accountid ,items.x,etc
(SELECT charges.mistotal FROM charges where items.id = charges.id)
FROM items,orders
WHERE date = '2008-10-02'
</code></pre>

<p>Here I am getting the error message as:</p>

<blockquote>
  <p><em>Subquery cannot return more than one values</em></p>
</blockquote>

<p>My values are 7.50, 25.00</p>

<p>I want to return the 25.00, but when I use </p>

<pre><code>(SELECT TOP 1 charges.mistotal FROM charges where items.id = charges.id)
</code></pre>

<p>My result is 7.50 but I want to return 25.00</p>

<p>Does anyone has any better suggestion?</p>

Under what criteria you choose to select the 25.00 instead of the 7.5?
If its related to the maximum value, you can try using the
MAX()
function on that field.
If its related to the chronologically last row added, try using the
MAX()
on the datetime field, if you have details on the hours and minutes it was added.