Kodi Community Forum

Full Version: Need help with sql for script
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm working on my first script and new to all this sql stuff.
trying to get a list of all episodes grouped and in the right order.

this is the line i'm using:
select * from episodeview group by idShow order by c12,c13

but for some reason the order is not good. it's like the c12 and c13 only have numbers in this fields but still don't treat them like this.
wow thought it's easy one...

OK, I'vew tried this one:
PHP Code:
select idshow,strTitle,min(c12),min(c13),c00,playcount from episodeview
where playcount is null 
and c12 is not 0 
group by idshow 


but it still not getting the right order of episodes.
when a show got more then ten episodes it's treat this like text and look for the first character instead like numbers.

like this:
1,10,11,12,13,14,15,16,2,3,4,5,6...

any ideas?
That's a normal alphabetical sort. Nothing wrong with it per-se. You may be able to fix it by letting sqlite know that the column you want to sort on is an integer.
search google for CAST in SQL
Thank you, it worked.

Now it's time to learn python Smile