DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   MySQL (http://www.daniweb.com/forums/forum126.html)
-   -   Help with SQL Query (http://www.daniweb.com/forums/thread159694.html)

rexmont Nov 27th, 2008 5:10 am
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 only 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.

omrsafetyo Nov 28th, 2008 8:44 pm
Re: Help with SQL Query
 
What have you tried so far?

rexmont Dec 3rd, 2008 10:48 am
Re: Help with SQL Query
 
I achieved the result by using global arrays (in ASP) not using SQL Query.
...

verruckt24 Dec 8th, 2008 3:41 am
Re: Help with SQL Query
 
I think you would need to use Stored Procedures for this. Check MySQL Stored Procedures for their usage.


All times are GMT -4. The time now is 8:49 pm.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC