[OT} Any SQL Experts Here?

Stephen stephen-d-bJEeYj9oJeDQT0dZR+AlfA at public.gmane.org
Thu May 28 13:31:54 UTC 2009


Any SQL experts here?

I am trying to enhance my web site and I can’t come up with the query 
that I need.

Briefly, I have table A and table B

The unique primary keys in table A, are present in a column in table B. 
It is a one to many relationship.

Currently, I select all of table A, plus the row count of table B, 
indicating how many table B rows have the primary key of the table A row.

Now, I want to add an additional field from column B, for the first 
matching row. But I need to something equivalent to a LIMIT 1 on the 
table B rows, so the final result set has the same number of entries as 
rows in table A.

I am using the PDO class in PHP against a MySQL database.

I will send the full detail to anyone willing to take a look.

Thanks!

Stephen

--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list