Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 group by queries

Author  Topic 

Jeskit@hotmail.co.uk
Starting Member

20 Posts

Posted - 2007-12-15 : 08:35:07
hi

can anyone help me create a group by query which shows how manycode of holidays are provided at each holiday code. i'm really having trouble with this. can anyone help.

thanks

jessica

p.s. if it helps i have inserted the table information.

CREATE TABLE Details_of_hoilday
(
Code_of_hoildays VARCHAR2 (20),
Country_visited VARCHAR2 (200),
Duration NUMBER,
Hoilday_code VARCHAR2 (30),
Description_of_hoilday VARCHAR2 (300),
Total_cost NUMBER,
PRIMARY KEY (Code_of_hoildays),
FOREIGN KEY (Hoilday_code)
REFERENCES Difficulty_ratings (Hoilday_code)
);

INSERT INTO Details_of_hoilday VALUES ('H1','USA','10','B','Yosemite and California','749');
INSERT INTO Details_of_hoilday VALUES ('H2','USA','16','C','Western National Park','1400');
INSERT INTO Details_of_hoilday VALUES ('H3','USA','21','E','Yellowstone','1021');
INSERT INTO Details_of_hoilday VALUES ('H4','India','10','B','Moghul Sites','1095');
INSERT INTO Details_of_hoilday VALUES ('H5','India','21','C','Tiger Safari','2100');
INSERT INTO Details_of_hoilday VALUES ('H6','China','11','B','China Highlights','1201');
INSERT INTO Details_of_hoilday VALUES ('H7','China','21','C','Great Wall Walk','2108');
INSERT INTO Details_of_hoilday VALUES ('H8','Spain','8','A','Andalusian Towns','647');
INSERT INTO Details_of_hoilday VALUES ('H9','Spain','15','B','Andalusian Walks','851');
COMMIT;

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2007-12-15 : 08:54:08
Select Count(*) as RecordCount,Code_of_Hoildays
FROM Details_of_Hoilday
GROUP BY Code_Of_Hoildays

check your spelling :)



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2007-12-15 : 11:14:42
this appears to be a table in oracle. for future reference, this forum is for sql server questions.


elsasoft.org
Go to Top of Page
   

- Advertisement -