Simon Simon - 1 year ago 287
SQL Question

MySQL Question (joins)

I'm not that into MySQL joins, so maybe you could give me a hand. I've got the following tables:

Table a
Fields ID,name

Table b
Fields aID,cID,ID,found

Table c
Fields ID,name

The result I want to get is the following: I want all the records where b.found = 1. Of these records I don't want or, but I want the number of records that would have been returned if I would have wanted so. So if there are five records that have b.found = 1 and = (for example) 3, then I want a returned value of 5, and

Someone is able to do this?

Actually this is what I want to get from the database:
A list of all records in table C and a count of records in table B that has found = 1 and b.c_id =

Answer Source
Table: a
Fields: ID, name

Table: b
Fields: aID, cID, found

Table: c
Fields: ID, name

JOIN c ON c.ID = b.cID AND b.found=1
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download