0

i am new to database querying so apologies for this rudimentary query question. thank you in advance.

table called "neuron"  
columns in "neuron" called "neuron_id", "neuron_name" + others (not relevant here)

neuron_id is unique identifier for each neuron_name;
say there are 5 entries, thus
neuron_id = 1,2,3,4,5 and corresponding
neuron_name = a,b,c,d,e

i would like to generate a list that contains neuron_id for select neuron_name. the following query does not work for me.

select neuron_id, neuron_name  
from neuron  
where neuron_name = "a" or "c" or "e"

i expect the following

1,a  
3,c  
5,e

but the above query only spits out

1,a
  • WHERE neuron_name IN ('a', 'c', 'e') – ypercubeᵀᴹ Feb 12 '14 at 15:03
1

Try this:

select neuron_id, neuron_name  
from neuron  
where neuron_name = "a" or neuron_name = "c" or neuron_name = "e"

Edit:

The solution from ypercube is more semantically correct.

select neuron_id, neuron_name  
from neuron  
where neuron_name IN ('a', 'c', 'e')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.