Re: Only part of a field SQL
| From: | W Clements | Date: | Wed, 11 Apr 2001 23:35:08 +0000 |
| Subject: | Re: Only part of a field SQL | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-8503@lists.php.net to get a copy of this message | ||
RDB--
You should try...
SELECT * FROM table WHERE INSTR(field1, '999997') > 0
[selects everything from 'table' where field1 has that job number within it]
Or, if you just wanted to run a query that would update every entry to not
include that "Job ID =" you could...
UPDATE table field1=SUBSTRING(field1, 10)
[modifies every field1 in 'table' to everything in field1 from the tenth
character until the end]
Hope this helps. Let me know if you need anything else. :)
- Will
----- Original Message -----
From: "Randall Barber" <rdb55@email.byu.edu>
To: <php-db@lists.php.net>
Sent: Wednesday, April 11, 2001 4:43 PM
Subject: [PHP-DB] Only part of a field SQL
Our Xerox production printers export a log in ':' delimited format.
No big deal, except that each field has a tag like so:
Job ID = 999999
Job ID = 999998
Job ID = 999997
See what I mean?
I have simply imported the whole CSV file into Access and was now wondering
if I could do the following?
Pull everything out of the field AFTER the '=' sign.
SELECT FIELD1, FIELD3, FIELD10 FROM ImportTable WHERE FIELD1=' everything
after the = sign ' AND FIELD3=' same idea ' AND FIELD10=' same idea '
So when I execute the query all I get for Job IDs is:
999999
999998
999997
Is there a way to do this in the query? I am totally inexperienced.
Thanks in advance,
RDB