----- Original Message ----- From: "Lefevre, Steven" <[EMAIL PROTECTED]> > The problem (as I see it) is that I'm storing the last name and the first > name in two seperate fields. I can make an SQL statement like "Select * from > Students Where LastName Like "Smith%";", but can I make something like > > "SELECT * FROM Students WHERE (LastName, ", ", FirstName) AS Name LIKE > "Smith, J%";"
Backing up, is the problem that you need to uniquely identify the student's name after returning the results? If so, a simple, efficient way is to add an auto_increment column to your students table, so each name is given a unique ID. Then, when results are returned, you can create a link for each student that includes the student's ID. If this isn't the case, and you really want to do a statement like that above, how about: SELECT * FROM Students WHERE LastName='Smith' and FirstName LIKE 'J%'; or worse, SELECT * FROM Students WHERE concat(LastName, ", ", FirstName) LIKE 'Smith, J%'; Ryan Fox sql, query, sausage --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php