General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Select one or the other
Hi All,
I'm trying to build a Select, but I can't get it to do what I want. This is the situation:
There's one table with three fields:
Field1 Field2 Field3
0 X A
0 Y B
0 Z C
1 X D
1 Y E
1 Z F
2 X G
2 Z H
I want to select field3 of every occurrence of field2 (X,Y and Z) where field1 is a certain value and if it doesn't exist the field3 of field1=0 should be selected. If I want this for field1=1 this would result in:
D
E
F
And if this is done for field1=2 it would result in
G
B (this one is of field1=0)
H
Who can do this the easiest way?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only