CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> General/Other

 Listbox

Print topic Send  topic

Author Message
xyla


Posts: 17
Posted: 06/16/2006, 8:20 AM

I would like to see 2 column in a listbox. I use the following sql...

SELECT city_id, (city_name & ' - ' & country_name) as 2cols FROM training_cities ORDER BY 2cols

Don't get errors just "0" zero's in the 2cols column
_________________
http://xyla.nl | Your Solution Provider
View profile  Send private message
mrachow


Posts: 509
Posted: 06/16/2006, 9:30 AM

Where and how do you specify your SQL statement?
E.g. could you show us please the complete syntax.
_________________
Best regards,
Michael
View profile  Send private message
xyla


Posts: 17
Posted: 06/16/2006, 9:41 AM

In the listbox data source I used the following SQL...

SELECT city_id, (city_name & ' - ' & country_name)
AS 2cols
FROM training_cities
ORDER BY 2cols

Listbox Bound Column set to city_id
Text Column set to 2cols


I used the MySQL VARCHAR (50) data type. Could this be a problem?
_________________
http://xyla.nl | Your Solution Provider
View profile  Send private message
E43509

Posts: 283
Posted: 06/16/2006, 10:14 AM

Looks like code I've done are you sure it is bringing back data?
View profile  Send private message
xyla


Posts: 17
Posted: 06/16/2006, 11:22 AM

Posted this question in the MySQL forum also.

The following answer i received, works fine...

SELECT city_id, concat(city_name, ' - ', country_name) AS 2cols
FROM training_cities
ORDER BY 2cols
_________________
http://xyla.nl | Your Solution Provider
View profile  Send private message
peterr


Posts: 5971
Posted: 06/16/2006, 11:36 AM

This syntax works for me with MS Access:
SELECT city_id, (city_name & ' - ' & country_name) as 2cols FROM training_cities ORDER BY city_name;

But keep in mind that different databases may use different syntax, so it's best to mention right away which database you're using.
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com
View profile  Send private message
mrachow


Posts: 509
Posted: 06/19/2006, 12:01 AM

MySQL uses the common string concatenation || for logical or.
But the other default function CONCAT is uses as expected.
CONCAT(city_name, CONCAT(' - ', country_name))
should do.
_________________
Best regards,
Michael
View profile  Send private message
WKempees
Posted: 06/19/2006, 3:03 AM

CONCAT_WS( ' - ', city_name, country_name )



Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.