[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PROGRAMMERING] [SQL] group by hjælp



Kim Schulz skrev:
On Wed, 30 May 2007 19:50:58 +0200
Kristian Nørgaard <sslug@sslug> wrote:

Min SQL syntax er lidt rusten...
- hvordan får jeg en liste med alle bøgers billigste pris og salgsted?

Tabel:

--id-----bogtitel ------  salgsted ------ pris

1    'Linux A-Z'            'Amazon'    '200'
2    'Linux A-Z'            'Metro'        '180'
3    'Mit liv som tux'    'Bogladen'    '99'
4    'Mit liv som tux'     'Amazon'    '199'
5    'Nørder'                 'Metro'          '50'


svaret må gerne være MYSQL kompatibelt / Kristian

Mon ikke det er noget ala:


SELECT * FROM tabel GROUP BY bogtitle ORDER BY PRIS ASC.



Hvis jeg husker korrekt vil det resultere i at den først sorterer efter at have grupperet. Det vil give noget a la:

5	Nørder		Metro		50
3	Mit liv som tux	Bogladen	99
1	Linux A-Z	Amazon		200

/SR

 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2007-06-01, 02:01 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *