473,382 Members | 1,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Adding literal text to a query

Hi All

This is probably very simple, but I just don't know the answer to it.

What I want to do is select 50 chars of a field and then put '...' at the
end of this selection, eg:

SELECT LEFT(DESC,50) + '...' FROM MyTable

The above doesn't work, but there must be some form of MySQL syntax that
lets me do this - right?

Thanks

Laphan
Jul 20 '05 #1
2 1367
Laphan wrote:
What I want to do is select 50 chars of a field and then put '...' at the
end of this selection, eg:

SELECT LEFT(DESC,50) + '...' FROM MyTable


The + operator is used for string concatenation in Microsoft SQL Server
and some other products.

In MySQL, the way to do what you want is:

SELECT CONCAT(LEFT(DESC,50), '...') FROM MyTable

See http://dev.mysql.com/doc/mysql/en/String_functions.html for more
information.

Regards,
Bill K.
Jul 20 '05 #2
Many thanks Bill

Much appreciated.

"Bill Karwin" <bi**@karwin.com> wrote in message
news:cd*********@enews4.newsguy.com...
Laphan wrote:
What I want to do is select 50 chars of a field and then put '...' at the
end of this selection, eg:

SELECT LEFT(DESC,50) + '...' FROM MyTable


The + operator is used for string concatenation in Microsoft SQL Server
and some other products.

In MySQL, the way to do what you want is:

SELECT CONCAT(LEFT(DESC,50), '...') FROM MyTable

See http://dev.mysql.com/doc/mysql/en/String_functions.html for more
information.

Regards,
Bill K.
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: sdowney717 | last post by:
What exactly is happening when a query is sent using the N in front of the string to be found? Under what conditions would someone use the N' in a query? I have been testing out some chinese text....
2
by: Shiju Poyilil | last post by:
Hi ! I have a requirement wherein i am binding a datalist which contains a label (Caption for the field) and some literal hidden fields and a dropdown list. When I am binding to the datalist.....
2
by: djc | last post by:
I have something like the following: --------------------------------------------------- Dim btnAddUpdateDetail As New LinkButton() btnAddUpdateDetail.Text = "Add/Update Issue Detail"...
3
by: Ron James | last post by:
I would like to add a CSS link to every page on my site - "<LINK href="BLT.css" type="text/css" rel="stylesheet">". This links needs to go in the <HEAD> of my page. I was hoping that I could...
2
by: Neo Geshel | last post by:
I am looking to add additional data into a "stream" that has been extracted from a database, but before it is sent to a control (Repeater, in this case). I have found ZERO (0) articles about...
2
by: _MC_ | last post by:
Hi, i want to structure two elements (each conists of 1 Label and 1 Textbox) in an Table. As I use an Content Place Holder, i thought it is possible to add the table via Controls.add(Literal)....
1
by: CapRand | last post by:
Hi, I am creating an ASP.NET site and have created a form which I have been able to dynamically with listboxes, labels etc from a database - using mainly form1.Controls.Add ..... Does anyone...
4
by: alun65 | last post by:
I'm attempting to programmatically build up some HTML in the code behind. Like so: // Create Hyperlink HyperLink link = new HyperLink(); link.NavigateUrl = "nice cat"; link.Text = "Cats...
2
by: Ken Fine | last post by:
I want to add the security question and answer security feature to the ChangePassword control. I am aware that this functionality is built into the PasswordRecovery tool. I have implemented the...
7
by: =?Utf-8?B?V2ViQnVpbGRlcjQ1MQ==?= | last post by:
I'm adding subheadings to a gridview. Each sub head has a few link buttons. I'm adding the controls in the rowdatabound event code follows: sorry about the length here. I have to be missing...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.