Gossamer Forum
Home : General : Databases and SQL :

Select command question

Quote Reply
Select command question
I have a group of numbers (separated by spaces) in a field that I would like to access.

I know what acctno is beforehand. Let's say it is 2306.

Lets say that I have the following in the relatedaccts column for the coa table:2206 2306 2406

I tried SELECT * FROM coa WHERE acctno IN (relatedaccts)

I received no errors but I did not get any results either.

Is there a way to do this?


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Select command question In reply to
IN() doesn't accept space delimited values, they must be single values, eg...

WHERE acctno IN(10000, 10001, 10002, 10003)
Quote Reply
Re: [Paul] Select command question In reply to
yep, I tried that too. It seems like it only finds the first value in the field

if acctno is 10001

then: WHERE acctno IN(10000, 10001, 10002, 10003)

returns false: It does not find the 10001 in the IN clause. Or for that matter the 10002 or 10003

But It will find 10000.

Weird...

????


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."
Quote Reply
Re: [esm] Select command question In reply to
Hi,

Would separating the different values to individual rows in another table be a solution for you? That way you would not have to have multiple values in a singel cell...

/ Netmos
Quote Reply
Re: [Netmos] Select command question In reply to
I think I ended up putting the info in another table

Thanks...!


Gene
"The older I get, the more I admire competence, just simple competence in any field from adultery to zoology."