Select statement limit results

I am currently performing a SELECT * FROM table_1 statement in php and that is fine but one of the fields I am returning and displaying is a bunch of text.  Is it possible to limit the text returned in this one field to a certain amount of characters?

How do I alter my SQL statement to do this, can you provide an updated sql statement?
pda4meAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pda4meAuthor Commented:
please keep in mind I am returning other fields as well but I wish to limit this one field.
0
nplibCommented:
select left(columnname, 10) as newcolumnname from table

if you want more columns you will have to name each one individually.

you can use * with sql functions.
0
pda4meAuthor Commented:
how would I fit this into my existing sql statement?  I need to still return the others fields for display, but I need to just limit the content field to a few characters?

Existing:
$query_tech_Updates = "SELECT * FROM tech_Updates";
0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

nplibCommented:
do you know the name of all your fields
0
pda4meAuthor Commented:
These are all the fields:
Update_No  
Category  
Sub_Category  
Subject  
Content  
Keywords
Link
Date_Created
Last_Update  
Author
Email
0
nplibCommented:
and which ones do you want to limit and how many characters?
0
pda4meAuthor Commented:
I want to limit the Content field to either a single sentence or if I can't do it by sentence by at lease 25 characters.
0
nplibCommented:
you can do it by sentence, as long as there is a period.
0
nplibCommented:

$query_tech_Updates = "SELECT Update_No, Category, Sub_Category, Subject, Keywords, Link, Date_Created, Last_Update, Author, Email, LEFT(Content, InSTR(Content, '.')) as Content FROM tech_Updates;";

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pda4meAuthor Commented:
getting this error when I place the line in:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '; LIMIT 0, 10' at line 1
0
nplibCommented:
that because you added more sql code at the end after the ;

; <-- has to be at the end of your sql code.
0
pda4meAuthor Commented:
yep, that was it...thanks!
0
pda4meAuthor Commented:
Awesome help, thanks!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Query Syntax

From novice to tech pro — start learning today.