Question : what's problem of select statement with group?

what's problem of select statement with group?

select cb.com_id,cb.branch_address from customer_branch cb, customers c
where c.tid=cb.com_id(+)
group by cb.com_id

Thank you!
Francis SZE
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
SQL> desc customers;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 TID                                       NOT NULL NUMBER
 COM_NUM                                            VARCHAR2(4000)
 COM_NAME                                  NOT NULL VARCHAR2(4000)
 COM_ADDRESS                                        VARCHAR2(4000)
 COM_TEL                                            VARCHAR2(4000)
 COM_FAX                                            VARCHAR2(4000)
 COM_CONTACT                                        VARCHAR2(4000)
 COM_MOBILE                                         VARCHAR2(4000)
 COM_COUNTRY                                        VARCHAR2(4000)
 COM_BRANCH                                NOT NULL NVARCHAR2(1)
 COM_SALE_ID                                        NUMBER
 COM_TRANSPORT_ID                                   NUMBER
 COM_PAYMENT_DAY                           NOT NULL NUMBER
 COM_HEADER_NAME                                    VARCHAR2(4000)
 COM_DISABLED                              NOT NULL NVARCHAR2(2000)
 COM_BALANCE                               NOT NULL NUMBER(12,2)
 COM_AREA                                           VARCHAR2(255)

SQL> desc customer_branch
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 TID                                       NOT NULL NUMBER
 COM_ID                                    NOT NULL NUMBER
 BRANCH_ADDRESS                                     VARCHAR2(4000)
 BRANCH_CONTACT                                     VARCHAR2(4000)
 BRANCH_TEL                                         VARCHAR2(4000)
 BRANCH_FAX                                         VARCHAR2(4000)

Answer : what's problem of select statement with group?

try :

select cb.com_id,cb.branch_address from customer_branch cb, customers c
where c.tid=cb.com_id(+)
and com_id = 1

You do not need a group by for this.
Random Solutions  
 
programming4us programming4us