Blog
Developers
Careers
Support
Contact
Gossamer Threads
Solutions
Results
About
Mailing Lists
Resource Centre
Forum
Tools
Home
Who's Online
Tags
Favourites
Login
Forum Search
(
Advanced Search
)
This forum
This category
All forums
for
Home
:
General
:
Databases and SQL
:
sql problem
Previous Thread
Next Thread
Print Thread
View Threaded
Mar 15, 2004, 7:23 PM
adash786
New User
(2 posts)
Mar 15, 2004, 7:23 PM
Post #1 of 2
Views: 5565
Shortcut
sql problem
The question is:
display the names of the major with two highest number of students
related tables are
student ( std_code, std_name, maj_name, std_birthdate)
maj_adv ( adv_code, maj_name)
can someone help with this queriy?
Mar 16, 2004, 5:48 AM
fuzzy logic
Enthusiast
(854 posts)
Mar 16, 2004, 5:48 AM
Post #2 of 2
Views: 5302
Shortcut
Re: [adash786] sql problem
In reply to
try this:
Code:
SELECT COUNT(student.maj_name) AS hits, maj_adv.maj_name
FROM maj_adv, student
WHERE maj_adv.maj_name = student.maj_name
GROUP BY maj_adv.maj_name
ORDER BY hits DESC
LIMIT 2
Philip
------------------
Limecat is not pleased.
Previous Thread
Next Thread
Print Thread
View Threaded