millsy007 Posted March 2, 2009 Share Posted March 2, 2009 I have a query that brings though a list of passenger names, is there a way in which I can set the length of each of these names to equal 10 characters. So even if I have shorter names eg "bob, demarcus, adam and scott" they would display with the shorter names filled as spaces, eg: bob |demarcus |adam |scott My Query is: (SELECT tb2.journey_dttm as departure, ('8' - tb2.occupancy) AS seats, (SELECT IF(GROUP_CONCAT(passenger_name SEPARATOR '|') IS NULL, '', GROUP_CONCAT(passenger_name ORDER BY passenger_name SEPARATOR '|')) FROM passengers WHERE journey_id = tb2.id ORDER BY passenger_name) AS passengers FROM shuttle AS tb1 LEFT JOIN journey AS tb2 ON "; ( tb1.id = tb2.shuttle_id ) LEFT JOIN trip_route AS tb3 ON ( tb2.route_id = tb3.id ) WHERE tb1.depart_dttm = '$depart_dttm' ORDER BY tb2.id ASC, tb2.route_id ASC); Quote Link to comment https://forums.phpfreaks.com/topic/147575-solved-setting-field-length-of-result-of-query/ Share on other sites More sharing options...
trq Posted March 2, 2009 Share Posted March 2, 2009 Take a look at rpad. Quote Link to comment https://forums.phpfreaks.com/topic/147575-solved-setting-field-length-of-result-of-query/#findComment-775073 Share on other sites More sharing options...
millsy007 Posted March 3, 2009 Author Share Posted March 3, 2009 Thanks Sorted Quote Link to comment https://forums.phpfreaks.com/topic/147575-solved-setting-field-length-of-result-of-query/#findComment-775522 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.