-
SQL Length Question
I am sure one of you sql gurus will know the answer to this. I want to check an sql field for its length and only select items which contain more then 800 characters. Here is hte code I am using that DOES NOT work :)
"SELECT * FROM monkey WHERE CHECK length(pet) > 800) ORDER BY views DESC";
-
I think your problem is you can't filter based on blob or memo fields, which I suspect your field "pet" is. Try creating a query that returns the length of "pet" for one record and see if you get a valid number. If you don't you'll know you can't use this method.
-
can you give me a sample sql blurb ?
-
select length(pet) as plength from table limit 1
-
Ok so I got a value. Does anyone now know how I can do a check and only list those with a value greater then 800? IE more then 800 chars. Thanks guys. I should add the code that I pasted in my original post doesnt cause an error just doesnt work :)
-
got it working thanks guys. It was a mixup in the sql and how i nested it.
-
Excellent news! BTW, which SQL database server are you using?
-
thanks for the help KLB and Chris you helped me get on the right track. And KLB I have no clue :) I count on Nexcess for that stuff lol.