Re: SQL joining from list of values to match single value?

2016-09-09 Thread Bob Sneidar
Correction: LIKE '%|763|%' On Sep 9, 2016, at 15:55 , Bob Sneidar mailto:bobsnei...@iotecdigital.com>> wrote: LIKE '%|763|&' ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe and manage your sub

Re: SQL joining from list of values to match single value?

2016-09-09 Thread Bob Sneidar
I got around the need for or-liking (I just made that up) by making sure the first (and last??) item of a list was blank. Ex. "|14|28|763|" If you do this, you can always look for LIKE '%|763|&'. Of course we know that to Livecode, a trailing delimiter does NOT mean the last item is blank, but S

Re: SQL joining from list of values to match single value?

2016-09-09 Thread Dr. Hawkins
On Fri, Sep 9, 2016 at 5:34 AM, Mike Kerner wrote: > If you really only have hundreds of records, and you aren't doing many > queries as part of the same operation, you have spent more time fighting > through this than you will save in the rest of your life running it. > Absolutely. It's not ab

Re: SQL joining from list of values to match single value?

2016-09-09 Thread Mike Kerner
If you really only have hundreds of records, and you aren't doing many queries as part of the same operation, you have spent more time fighting through this than you will save in the rest of your life running it. On Fri, Sep 9, 2016 at 12:42 AM, Kay C Lan wrote: > On Fri, Sep 9, 2016 at 6:37 AM,

Re: SQL joining from list of values to match single value?

2016-09-08 Thread Kay C Lan
On Fri, Sep 9, 2016 at 6:37 AM, Dr. Hawkins wrote: > > Do you include a delimiter after your first and last entries? It seems > clumsy, but I don't see a way around it with LIKE WHERE dpdDnas LIKE '7,%' OR dpdDnas LIKE '%,7,%' OR dpdDnas LIKE '%,7' I've found that leaving the list as a 'natural

Re: SQL joining from list of values to match single value?

2016-09-08 Thread Dr. Hawkins
On Thu, Sep 8, 2016 at 11:22 AM, Mike Kerner wrote: > I would make IS IN work, and do it in two queries, > Something like put revDataFromQuery(tab,vtab, theDb,"SELECT uniqDna, parDnas FROM theTable WHERE (parDnas <>'');" into theData split theData by vtab and tab or would > OR, in the cas

Re: SQL joining from list of values to match single value?

2016-09-08 Thread Bob Sneidar
I beg to differ. Sometimes lists are the best way to do it. I have a column that can contain any combination of 3 values: customer, site, and IT or nothing at all. I use vert bars as delimiter, so my query is ex. "... where contacttype LIKE '%|site|%'". I also have another column where a contact

Re: SQL joining from list of values to match single value?

2016-09-08 Thread Ben Rubinstein
This may be one of those unhelpful responses which suggests doing something different instead of answering your question, so apologies in advance - I don't know how to do the thing you're trying to do. But if you have control of the database structure, could you re-engineer to do use a separat

Re: SQL joining from list of values to match single value?

2016-09-08 Thread Peter Haworth
Never a good idea to put lists of items into a single column. If you need that capability, best to define another table with uniqdna column as a foreign key to your main table and a column to hold a single pardna, then have 1 row for each uniqdna/pardna pair. With thst structure the query is just

Re: SQL joining from list of values to match single value?

2016-09-08 Thread Mike Kerner
I would make IS IN work, and do it in two queries, OR, in the case where you have something less than 10k values, just build a container and chunk it. If that wasn't an option, I'd N:N it, and just add the extra tables and a join. On Thu, Sep 8, 2016 at 1:16 PM, Dr. Hawkins wrote: > I've been t

SQL joining from list of values to match single value?

2016-09-08 Thread Dr. Hawkins
I've been trying to wrap my head around this query for weeks, and hope someone can point out what I'm missing. In my table, the main key is uniqDna, an integer. There can also be dpdnDnas and parDnas, the uniqDna of a dependent or parent dna. I'm not seeking any good way to keep the dndDnas and