I'd like to have a query for the first and last name on an enrollment list so that only one result show. However, if only the last name is chosen in the query multiple answers will show.
A:
You can GROUP BY
the last name field in your query.
For example if you had this data:
MyTable: id last_name first_name 1 Smith John 2 Smith Jane 3 Jones Paul
Running a query like this:
SELECT t.last_name
FROM MyTable t
GROUP BY t.last_name
ORDER BY t.last_name
...would return these two rows:
Jones Smith
Adam Bernier
2010-04-22 01:58:10
I'm using mysql as the database and php. I'm also woeking with dreamweaver. I can do a simple query (like the one above) however, I can't do a query that has more than one answer. I'd like to query by both the first and last name. So if I have more than one "Smith" I can get the right one.
tom
2010-04-22 11:56:21