Re: [sqlite] Data Manipulation ?
A neat way to do what you want is to set up a table cross-referencing State mnemonics like CA with California, and then use a lookup as suggested by an earlier correspondent. Finally raise a VIEW containing the complex SELECT statement so that you can do your query with the simplest SQL. If you are constantly referring to California, make a VIEW just for that query. JS -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/)
RE: [sqlite] Data Manipulation ?
Here's a way to go with pure SQL; create table cars (recid,qty,make,model,year,engine,color,state,price); create table states (abbr,name); insert into states values("ca","California"); insert into cars values(1,5,"Ford","Bandit",2005,2000,"Red","ca",5000); select make,(select name from states where abbr=state) as statename from cars; Steve -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] rg] On Behalf Of Richard Nagle Sent: 26 September 2005 04:14 To: sqlite-users@sqlite.org Subject: [sqlite] Data Manipulation ? 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... Fields are as follows: recid qty make model year engine color state price Thanks - Richard -- I will not be pushed, filed, stamped, indexed, briefed, debriefed, or numbered! My life is my own - No. 6
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/)
Re: [sqlite] Data Manipulation ?
Richard, If you need any help I'm available under contract. I'll be in L.A. next week on business with a client, but otherwise I will be free. I've been programming for 10+ years and what you need done is very simple and I could charge for a minimum number of hours and you will have a full functional solution. Doug On 9/25/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... > > Fields are as follows: > > recid > qty > make > model > year > engine > color > state > price > > > Thanks - > Richard > > -- > > I will not be pushed, filed, stamped, indexed, briefed, debriefed, or > numbered! > My life is my own - No. 6 > -- - Doug Hanks = dhanks(at)gmail(dot)com