Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with query 1

Status
Not open for further replies.

bouwob

Programmer
Apr 12, 2006
171
US
i have a set of data

product, hour, sales
col1,1,234
col1,1,345
col2,1,456
col2,1,345
col1,2,342
col1,2,6543
col2,2,23
col2,2,634

What I need

col1, 1, 234, 345

what I am getting

col1, 1, 234, 234
col1, 1, 345, 345


select
distinct (hour),
product,
max(sales),
min(sales)
from
table
group by
hour,
product,
sale


I would have thought that the above would give my about 2000 rows but instead it gives me every row. How do I go about pulling distinct columns.



 
What about this ?
select
product,
hour,
max(sales),
min(sales)
from
table
group by
product,
hour

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That worked.

Why on earth does informix consider a distinct to mean everything in the select? This to me seems fairly ill-logical.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top