PERFECT! Thanks Puneet!
Mr. Puneet Kishor-2 wrote: > > > On Apr 18, 2012, at 11:20 PM, starvingpilot wrote: > >> >> >> >> Puneet Kishor-2 wrote: >>> >>> >>> On Apr 18, 2012, at 11:10 PM, starvingpilot wrote: >>> >>>> >>>> Here's a query that works >>>> >>>> sqlStatement = [NSString stringWithFormat:@"SELECT * FROM stations >>>> WHERE >>>> state like '%@ %'",theState]; <--- this yields a result: 0 >>>> >>>> sqlStatement = [NSString stringWithFormat:@"SELECT state, power || ' >>>> kW' >>>> power FROM (SELECT state, Cast(Rtrim(power, 'kW') AS 'numeric') power >>>> FROM >>>> stations ORDER BY power)",theState]; >>>> >>>> I get a result: 1 from that last one... "theState" in this code is a >>>> variable for that specific state I need. >>> >>> >>> I don't see a question above. It's not clear if you are asking >>> something. >>> Wrt to filtering by state, I already sent you an example for that. Hope >>> that helped. >>> >>> >>> -- >>> Puneet Kishor >>> >>> _______________________________________________ >>> sqlite-users mailing list >>> sqlite-users@sqlite.org >>> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users >>> >>> >> >> Your query netted a result of ALL states... I'd like to search a specific >> state for example.. I'd like to find antennas in CA only and order by >> power. > > > didn't you get the following? It returns rows for only 'CA' > > SELECT state, power || ' kW' power > FROM ( > SELECT state, Cast(Rtrim(power, 'kW') AS 'numeric') power > FROM stations > WHERE state = 'CA' > ORDER BY power > ); > > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > -- View this message in context: http://old.nabble.com/trim-alpha-numeric-string-so-it%27s-numeric-cast-then-order-tp33711898p33712052.html Sent from the SQLite mailing list archive at Nabble.com. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users