0

In my Sql have...4 tables like..

classtable
sid     date    timetableid
ct1      -       tt1
ct2      -       tt2
ct3     --       tt3

and my Timetable

sid    startDate   skillsetid
tt1      ---        ss1
tt2      ---        ss1
tt3      ---        ss2

and my Skillset

sid     courseid
ss1        c1
ss2        c2

and finally my Course table.

sid    name
c1     java
c2     flex

Finally my requirement is count the no.of courses.. using Classtable

for example according to above tables 2-java and 1-flex so these count will be displayed on my html page like 2(java) or 4(flex)..etc .. what ever we get the count... so please suggest me how to get count and display on html..

1 Answer 1

2

Join your tables and group the result:

SELECT   Course.name, COUNT(*)
FROM     classtable
    JOIN Timetable ON Timetable.sid = classtable.timetableid
    JOIN Skillset  ON  Skillset.sid = Timetable.skillsetid
    JOIN Course    ON    Course.sid = Skillset.courseid
GROUP BY Course.sid

See it on sqlfiddle.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.