[thelist] SQL gurus
Oren Levin
lists at pinetree.net
Fri Mar 25 15:12:13 CST 2005
Ted,
The syntax may depend on the database but you can use the following in
Oracle:
SELECT date, mileage, DECODE(INSTR(notes, 'brakes'), 0, 'Match', NULL) AS
IS_MATCH
FROM m
;
Oren
-----
Oren Levin, Senior Developer
olevin at audible.com, 973.837.2811
"Audible.com ranks among the Web's best services."
CNet.com, July 2004
-----Original Message-----
From: thelist-bounces at lists.evolt.org
[mailto:thelist-bounces at lists.evolt.org] On Behalf Of Theodore Serbinski
Sent: Friday, March 25, 2005 3:13 PM
To: thelist at lists.evolt.org
Subject: [thelist] SQL gurus
Ok guys need some help with SQL. Simple example:
SELECT * FROM m ----->
2005-03-24 95534 changed brakes
2005-03-24 235235 changed tires
Now I have:
SELECT date,mileage FROM m WHERE notes LIKE '%brakes'%' ---->
2005-03-24 95534 changed brakes
Good so far. But now what I want to do is display the results of the
first query AND highlight any results that are found (not show only
the results but everything).
Is there a way in SQL to do this... like adding a field so the array
comes back as:
2005-03-24 95534 changed brakes match
2005-03-24 235235 changed tires
Note the extra field "match" for only matches... this would make it
much easier in PHP to loop ... if field value == match then make bold,
or whatever.
Otherwise, seems to I have 2 arrays and need to check things which
seems inefficent.
Make sense? Whew it's friday and i'm brain dead so hope this works :)
ted
--
* * Please support the community that supports you. * *
http://evolt.org/help_support_evolt/
For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !
More information about the thelist
mailing list