mhoram Posted March 12, 2007 Share Posted March 12, 2007 Hi all I am fairly new to Postgres. I'm looking for a way to query my database such that it only returns results that start with a particular letter. Can anyone help with this? Thanks in advance Karl Quote Link to comment https://forums.phpfreaks.com/topic/42341-solved-need-query-to-return-results-that-start-with-a-specified-letter/ Share on other sites More sharing options...
artacus Posted March 13, 2007 Share Posted March 13, 2007 SELECT * FROM thing WHERE myfield LIKE 'A%' Quote Link to comment https://forums.phpfreaks.com/topic/42341-solved-need-query-to-return-results-that-start-with-a-specified-letter/#findComment-205962 Share on other sites More sharing options...
btherl Posted March 13, 2007 Share Posted March 13, 2007 This query may need to scan the whole table, depending on the locale your database was created in. Use "explain" to check the query plan to be sure. Quote Link to comment https://forums.phpfreaks.com/topic/42341-solved-need-query-to-return-results-that-start-with-a-specified-letter/#findComment-206081 Share on other sites More sharing options...
mhoram Posted March 14, 2007 Author Share Posted March 14, 2007 Thanks very much for the replys, that works perfectly Quote Link to comment https://forums.phpfreaks.com/topic/42341-solved-need-query-to-return-results-that-start-with-a-specified-letter/#findComment-206913 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.