Re: Truncation?
| From: | php3 at developersdesk dot com | Date: | Thu, 09 Nov 2000 12:25:59 +0000 |
| Subject: | Re: Truncation? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-24480@lists.php.net to get a copy of this message | ||
Addressed to: =?iso-8859-1?Q?Daniel_Als=E9n?= <daniel@innehallsbolaget.com>
php-general@lists.php.net
** Reply to note from =?iso-8859-1?Q?Daniel_Als=E9n?= <daniel@innehallsbolaget.com> Thu, 9 Nov
2000 11:14:10 +0100
>
> Hi!
>
> Can i truncate SELECT from MySQL?
>
> I have a table with a field for article numbers. They are categorized
> with the first character. I need to be able to call up a category of
> articles from that (ie x* or f* (where the actual article numbers look
> like x003 or f674)).
SELECT *
FROM Table
WHERE ArticleNumber LIKE 'x%';
Should be one soloution. You will want an index on ArticleNumber.
Another, possibly faster solution would be to use a function to compare the
first character of ArticleNumber with 'x' or 'f'. There is quite a
selection of functions like that you can use in MySQL. I don't have time
to find the URL for you, but you can start at www.mysql.com, and follow the
links into chapter 7 of the manual. Look for a section named something
like "Functions for use in Select and Where clauses".
Rick Widmer
Internet Marketing Specialists
www.developersdesk.com