|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
OR logic Q?
Hi,
One of the fields in a table is set as VARCHAR ()Typicaly looks like: 1,2,6 or 0,4,5 ... I am basicaly saving options of a form and storing the coldfusion list in the field. My problem resides when I try to get a select of multiple options... IE: I want to have a select of all the rows that match either 0 or 4... The dumbed down query looks like this: Code:
SELECT EX_ID, EX_FIRST_NAME, EX_LAST_NAME, EX_COUNTRY_LOC, EX_MAIN_TYPE FROM EXPERTS_LIST WHERE 1 = 1 AND EX_ACTIVE = 1 AND ( '999999' IN (EX_MAIN_TYPE) // This value does not exist, I just used it to start the loop done in CFML OR '0' IN (EX_MAIN_TYPE) OR '4' IN (EX_MAIN_TYPE) ) ORDER BY LOWER(EX_COUNTRY_LOC), LOWER(EX_LAST_NAME) My problem is that it returns rows where the value is either 0 or 4, but NOT where both '0' and '4' were saved (IE: 0,4). I must be missin' something in the 'OR' logic here...
__________________
Saintaw pending. |
|
#2
|
|||
|
|||
|
Quote:
It is your database design that is amiss. Never store multiple values in a column. Search for articles on normalization, they abund. |
|
#3
|
||||
|
||||
|
Yes, I'd personaly have used a reference, and store the values as NUMBER in another table, but I cannot change the DB design.
I think I found a solution though, I was using the above as if they were INTs and I need to treat it as a string... I'll post it when I get in the office. |
![]() |
| Viewing: Dev Shed Forums > Databases > Oracle Development > OR logic Q? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|