-
Help with SQL Query
Hello all,
lets say i have a table like this which has 3 columns and 3 rows;
----------------------------------------------+
COLUMN_A.....|.....COLUMN_B.....|...COLUMN_C |
......X............|...........X........... |.........X.......|
......X............|...........-............|.........X.......|
......-............|...........-............|.........X.......|
----------------------------------------------+
So, now i have an input like; (user submits a form)
----------------------------------------------+
......X............|...........X............|..... ....-.......|
----------------------------------------------+
now; the first column of row#1 is X so it is same as the input. the 2nd column of row#1 is X so it is also same as the input. and obviously third column of row#1 is not "-" so it is different. So, this row's score is "2".
with same point of view 2nd row's score is "1" (input is matching with COLUMN_A.)
and finally third row is completely different from input. All columns are differs from input. so its score is "0".
Finally the question is; how can i build this "scoresheet" with a fast sql query.
Thanx in advance.
-
Help with SQL Query
select decode(a||b||c,'xxx','2','x-x','1','0') from ex
assume ex is a table name
a,b,c are columns in the table of varchar2 type
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|