Jump to content


Photo

how to limit the number of digits returned in a field


  • Please log in to reply
2 replies to this topic

#1 deejay

deejay
  • New Members
  • Pip
  • Newbie
  • 6 posts
  • LocationBournemouth, UK

Posted 11 April 2003 - 09:52 AM

Hi

basically i am making a search which has a description in it, what I want to do is only return 150 letters of that description. i thought this would work from the manual but it doesn\'t

<?php
SELECT 

table1.title,
table1.idnumber,
table1.description(LEFT,150)

FROM table1
?>

anyone know what I should be doing.

Thanks

Deej

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 11 April 2003 - 04:59 PM

try this:

SELECT

table1.title,
table1.idnumber,
LEFT(table1.description,150)

FROM table1


Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 deejay

deejay
  • New Members
  • Pip
  • Newbie
  • 6 posts
  • LocationBournemouth, UK

Posted 14 April 2003 - 10:44 AM

hi

Thanks for that, i found I had to add AS to get it to work.

<?php

LEFT(product_pages.main_desc,450) AS description_one,  


?>

and now works, cheers




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users