On 05/15/2011 09:14 AM, Igor Tandetnik wrote:
> Pontiac wrote:
>> On 05/13/2011 03:15 PM, Trevor Borgmeier wrote:
>>> SELECT categories FROM myTable WHERE (","||categories||",") LIKE "%,7,%";
>> Careful with how you have your like. As an added bonus, if you were to
>> hunt for category 1, your st
on 5/14/11 9:02 AM Trevor Borgmeier wrote:
> ...I was surprised when I tried a similar query with the same data in MySQL
> and saw that it worked -- MySQL parsed the fields contents as if they were
> separate items.
I just wanted to correct my statement about my MySQL query -- I wasn't
using IN,
Pontiac wrote:
> On 05/13/2011 03:15 PM, Trevor Borgmeier wrote:
>> SELECT categories FROM myTable WHERE (","||categories||",") LIKE "%,7,%";
>
> Careful with how you have your like. As an added bonus, if you were to
> hunt for category 1, your statement would be LIKE "%,1,%" which would
> retur
On 05/13/2011 03:15 PM, Trevor Borgmeier wrote:
> I have a database where a field's value is a comma separated list
> indicating the basic categories the item belongs to.
>
> so if the "categories" field has a value of "1,8,15"
>
> I want to do a query like this:
>
> SELECT categories FROM myTable
Thanks for the responses. The three table approach you describe is what
I normally use, but the export is coming from a filemaker database where
they are stored this way so I thought I'd play with it as is. I was
surprised when I tried a similar query with the same data in MySQL and
saw that i
On May 13, 2011 8:17 PM, "BareFeetWare" wrote:
> There is no function built into SQLite to convert a text string into a set
(eg convert "1,8,15" into (1, 8, 15)), but such a function is not needed in
this case. You need a better design of your database. SQLite is relational
and you need to make yo
On 14/05/2011, at 5:15 AM, Trevor Borgmeier wrote:
> I have a database where a field's value is a comma separated list
> indicating the basic categories the item belongs to.
>
> so if the "categories" field has a value of "1,8,15"
>
> I want to do a query like this:
>
> SELECT categories FROM
> SELECT categories FROM myTable WHERE (","||categories||",") LIKE "%,7,%";
>
> but I'm guessing LIKE isn't as efficient, and the query is more
> awkward. Any advise would be appreciated. Thanks!
This LIKE is the only way to get information from your table. But you
can do it more efficiently by
On May 13, 2011, at 9:15 PM, Trevor Borgmeier wrote:
> so if the "categories" field has a value of "1,8,15"
Yep, it's a text column. Nothing relational about it.
> Any advise would be appreciated.
Normalize your design.
___
sqlite-users mailing lis
I have a database where a field's value is a comma separated list
indicating the basic categories the item belongs to.
so if the "categories" field has a value of "1,8,15"
I want to do a query like this:
SELECT categories FROM myTable WHERE "8" IN (categories);
but it only finds records where
10 matches
Mail list logo