First you must know: I have two tables "USERS" and "SONGS"
How is possible to check some conditions and place the result on a temp column? For example foreach song in result of select must be calculate the bool and add it to temp column so I can do other calculations then and make it the primary order......
$USER = SELECT * FROM USERS WHERE SOMECONDITION
SELECT * FROM SONGS
------
(
IF SONGS.LANG LIKE $USER[LANG] THEN TEMPCOLUMN.ADD "1" ELSE TEMPCOLUMN.ADD 0
IF SONGS.GENR1 LIKE $USER[GENR1] THEN TEMPCOLUMN.ADD "1" ELSE TEMPCOLUMN.ADD 0
IF SONGS.GENR2 LIKE $USER[GENR2] THEN TEMPCOLUMN.ADD "1" ELSE TEMPCOLUMN.ADD 0
)
------
ORDER BY TEMPCOLUMN DESC
This should do the same thing: