Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Problem Query
Message
De
24/07/2000 22:05:55
 
 
À
19/07/2000 14:02:55
Information générale
Forum:
Oracle
Catégorie:
PL/SQL
Titre:
Divers
Thread ID:
00393781
Message ID:
00396448
Vues:
8
Sorry for delayed response, Matt.

I looked up the book that covers Standard SQL and it says..

" SELECT select_list
FROM table_list
[ where condition ]
GROUP BY group_by_list
In most SQL dialects, every item in the GROUP BY list must be a column name
(not an expression) and must be equivalent to or a subset of select list items - you can make groups only out of things you select . "
.....
Restrictions. GROUP BY looks straightforward, but it's caused its share of headaches for SQL users.
Here,for example, is a query that seems reasonable but won't work on most systems:
SQL"
select pub_id, type, count(type)
from titles
group by pub_id

Since the table is divided into sets by publishers (group by pub_id) and there are three publishers, the query must returen no more than three rows, and each select list item must have a single value for the set. Unfortunately, there is more than one type per publisher, so most systems find the query impossible to answer. You could solve this problem by adding type to the GROUP BY clause, ..

select pub_id, type, count(type)
from titles
group by pub_id, type
"
You'd better think You must identify every select list in group by list no matter what the DBMS is.

Hope this help.
OCP8 DBA
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform