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
>> [email protected]
>> 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
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users