Hello I got a problem when Im going to sort one of the tables I have.
If one of the the tables column is current_number > 0 I want to sort it by the current number but if the column is current_number < 1 I want to sort it by the start_number but when I select the tables I cant get the if or else to work.. it looks like this now:
The IF statement is still in the Select section so Is it possible to place an else or something like that? final_number is the one Im later on use sort desc / asc with.HTML Code:$listing_sql = "select ..... some stuff and..... IF(s.status, s.specials_status, p.current_number) as final_number.
hmm to clear this up a bit, lets say I have those four numbers in the two columns:
10 - start_number (this one have current_number 0)
15 - current_number
20 - start_number (this one have current_number 0)
25 - current_numbers
now I want to sort them with a button called "Sort number", The button is using the name final_number that I made when I selected the tables (see the html code). Is it even possible to mix them and then sort them.
Basically I wanna know if its possible to use two different columns as the same Alias but during certain circumstances.
Hope you understand what im talking about![]()



Reply With Quote

Bookmarks