Hello everyone.
I'm having trouble with this select statement I need help with.
sample table:
date1 order_no p_amt
8/11/06 123 800
3/27/07 123 800
3/28/06 123 800
9/11/07 123 0
I want the output of min date with p_amt <=0.
When a select statement I get the output of 3/27/07, it ignores the p_amt
column . any suggestions.
thanks in advance.
On Jun 6, 12:39 pm, ITDUDE27 <ITDUD
@discussions.microsoft.com>
wrote:
> Hello everyone.
> I'm having trouble with this select statement I need help with.
> sample table:
> date1 order_no p_amt
> 8/11/06 123 800
> 3/27/07 123 800
> 3/28/06 123 800
> 9/11/07 123 0
> I want the output of min date with p_amt <=0.
> When a select statement I get the output of 3/27/07, it ignores the p_amt
> column . any suggestions.
> thanks in advance.
You want the minimum value of date1 from those rows where p_amt is
less than or equal to zero.
SELECT min(date1) FROM tbl WHERE p_amt <= 0
See? It almost writes itself.