Germaris Posted September 14, 2008 Share Posted September 14, 2008 Hi there ! I maintain a database of former students (more than 32000 entries). I wish to build a query to retrieve in lastName field all and only the two letter names it contains. Something like: $query =mysql_query ("SELECT school, lastName, firstName, promo, region, gone FROM $table WHERE lastName LIKE XXXXXX ORDER BY lastName, firstName, school, promo" ) What should I write where the XXXXXX are? Sorry to be somehow... stupid! And many thanks in advance for your help! Link to comment https://forums.phpfreaks.com/topic/124188-solved-query-to-retrieve-two-letter-names/ Share on other sites More sharing options...
Mchl Posted September 14, 2008 Share Posted September 14, 2008 WHERE CHAR_LENGTH(lastName) = 2 Link to comment https://forums.phpfreaks.com/topic/124188-solved-query-to-retrieve-two-letter-names/#findComment-641350 Share on other sites More sharing options...
Germaris Posted September 14, 2008 Author Share Posted September 14, 2008 This was too simple for my tired mind !!! Thank you SO MUCH ! Link to comment https://forums.phpfreaks.com/topic/124188-solved-query-to-retrieve-two-letter-names/#findComment-641357 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.