SELECT w. GROUP BY

SELECT w. GROUP BY

Post by johnnie is » Sat, 04 Jul 1998 04:00:00



try this

select col1,col2, min(col3+col4)
from table1
group by col1, col2

can it solve the problem?


> Hi Johnnie!


> > try select col1, col2, min(col3)
> >         from table1
> >         group by col1, col2

> > min(col3) or max(col3) if you like

> Thanks a lot, but this will give me an almost random value of each column.
> Which means that it could mix up addresses:

> Street / ZIP Code
> Parc Plaza / 15233
> Battle Ridge Pl. / 32342
> Min (Parc Plaza, Battle Ridge Pl.) = Battle Ridge Pl.
> Min (15233, 32342) = 15233

> ===> Battle Ridge Pl. / 15233

> So I can't do it this way, but it's a good idea anyway...

> bye,
>        Lars

 
 
 

1. select a group from a group

Hi,
I need your help in solving this problem:

we have the following tables:
 property(propertyID(number), propertyName(number))
 articleProperty(articleID(number), propertyID(number))
 locationProperty(locationID(number), propertyID(number))
as U may guess in last tables propertyID refences propertyID in first
table.

having one articleID, find all locations that have at least the same
properties as that article. (at least means locations _must_ have
articles's prop but can have other props also)

my best guess is:
select distinct l.locationid from locationproperty l where
 (select propertyid from articleproperty where articleid=1) in
 (select propertyid from locationproperty where
locationid=l.locationid)

of course this dose not work.

thanks

2. Where to download?

3. How to get only the first row by GROUP in a SQL SELECT with GROUP BY

4. ADO command parameter object and stored procedure calls from VC

5. Selects within selects - problem with group bys.

6. varchar2 length and writing too much

7. Select within select group by

8. Need help for SQL script!

9. Rolling Up a Group (or, Grouping a Group)

10. how to select a group of records for asp pages

11. Group By select statement

12. SELECT w. GROUP BY

13. Bug with case in group by on select, still exists in SP5A