I have two tables in a MySQL database, first there is a list of names in the department.
Department's short name name ------------- | ------------- ACC | Accounting bus. Business ... In the second table there is a list of courses in which the name of the department is abbreviated.
course section | Name ------------- | ------------- ACC-101-01 | Introduction to Accounting ACC-110-01 | More accounting bus-200-02 | Business etc. ... I would like to write a question, for each row in the departments table, count me how many curriculum Rows in the table are like my short name something like this: short name | Number ------------- | -------------- ACC | 2 buses 1 ... I can do this with a query for a personal department
from SELECT COUNT (*) course where section '% ACC % (Gives me 2) Although I can loop through PHP and I can do the above questions many times, I want to do this in a single query. This is pseudocode, I'm thinking ... SELECT department.abudget, select from the sections from each row SELECT COUNT (*) as the numbers from the classes where the segment like CONCAT ( '% Any ideas?'
ex> select Join D.Bagent, COUNT (*) numbers D. Inner Course Sea on C. Sections such as Concrete (D.Abet, "%") Group by D. B.F.
No comments:
Post a Comment