There is a built-in functionality you could use: case.  For example, here's
a query against the state column that shows the results with nice names.
You'd have to add the other state names to the query, but you get the idea.

select recid, qty, make, model, 
        case state
        when 'ca' then 'California'
        when 'ny' then 'New York'
        when 'ma' then 'Massachusetts'
        else state end as fullstate
from mytableofcars;


--Ned.
http://nedbatchelder.com
 

-----Original Message-----
From: Firman Wandayandi [mailto:[EMAIL PROTECTED] 
Sent: Sunday, 25 September, 2005 11:43 PM
To: sqlite-users@sqlite.org; [EMAIL PROTECTED]
Subject: Re: [sqlite] Data Manipulation ?

On 9/26/05, Richard Nagle <[EMAIL PROTECTED]> wrote:
> Does SQLite support any direct built-in commands, that can
> manipulate data?
>
> ie.
> suppose the boss wanted a report of cars honda in CA,
> but he wants to see the California instead of CA,
> so you need to convert all the state fields into full names,
> how would this be done...
>

There's no built-in function for this cases, you need something like
replace(), see http://sqlite.org/lang_expr.html for the built-in
functions. You need the aggregate functions.

I use SQLite with PHP, so it's easy to create the aggregate functions.

> Fields are as follows:
>
> recid
> qty
> make
> model
> year
> engine
> color
> state
> price
>
>
> Thanks -
> Richard
>


Regards,
--
Firman Wandayandi
Never Dreamt Before (http://php.hm/~firman/)

Reply via email to