Need help with sql for script
#1
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.
Reply
#2
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?
Reply
#3
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.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#4
search google for CAST in SQL
Reply
#5
Thank you, it worked.

Now it's time to learn python Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Need help with sql for script0