[dba-Tech] MySQL Syntax: Fresh eyes needed

Hans-Christian Andersen hans.andersen at phulse.com
Sat Mar 16 20:01:28 CDT 2013


Hi Arthur,

You could also use the 'where'/'case' syntax in this case, no?

- Hans


On 2013-03-16, at 5:51 PM, Arthur Fuller <fuller.artful at gmail.com> wrote:

> For what it's worth, I finally arrived at the correct syntax:
> 
> <mysql>
> SELECT
> ifnull(`customers`.`Company`,concat(`customers`.`Last Name`,',
> ',`customers`.`First Name`)) AS `File As:`,
> ifnull(`customers`.`Company`,concat(`customers`.`First Name`,',
> ',`customers`.`Last Name`)) AS `Customer Name`,
> </mysql>
> 
> A.
> 
> 
> On Sat, Mar 16, 2013 at 6:38 PM, Peter Brawley
> <peter.brawley at earthlink.net>wrote:
> 
>> On 2013-03-16 9:43 AM, Rocky Smolin wrote:
>> 
>>> OR does it need brackets like [Last Name]?
>>> 
>> 
>> MySQL doesn't support brackets. Requires backticks.
>> 
>> PB
>> 
>> 
>> 
>>> R
>>> 
>>> -----Original Message-----
>>> From: dba-tech-bounces@**databaseadvisors.com<dba-tech-bounces at databaseadvisors.com>
>>> [mailto:dba-tech-bounces@**databaseadvisors.com<dba-tech-bounces at databaseadvisors.com>]
>>> On Behalf Of Stuart McLachlan
>>> Sent: Saturday, March 16, 2013 6:51 AM
>>> To: Discussion of Hardware and Software issues
>>> Subject: Re: [dba-Tech] MySQL Syntax: Fresh eyes needed
>>> 
>>> Try 'customers.Last Name' instead of customers.`Last Name' etc
>>> 
>>> --
>>> Stuart
>>> 
>>> On 16 Mar 2013 at 8:35, Arthur Fuller wrote:
>>> 
>>> I've been staring at this expression too long and my eyes are
>>>> beginning to
>>>> cross:
>>>> <,mysql>
>>>> SELECT
>>>> IF(ISNULL(customers.`Last
>>>> Name`),customers.Company,**CONCAT(customers.'First
>>>> Name',' ', customers.'Last Name')) as 'File As:'
>>>> from `customers`
>>>> </mysql>
>>>> 
>>>> Syntax error. The Concat() part works fine in isolation so the problem
>>>> is not there
>>>> 
>>>> TIA,
>>>> Arthur
>>>> ______________________________**_________________
>>>> dba-Tech mailing list
>>>> dba-Tech at databaseadvisors.com
>>>> http://databaseadvisors.com/**mailman/listinfo/dba-tech<http://databaseadvisors.com/mailman/listinfo/dba-tech>
>>>> Website: http://www.databaseadvisors.**com<http://www.databaseadvisors.com>
>>>> 
>>>> 
>>> ______________________________**_________________
>>> dba-Tech mailing list
>>> dba-Tech at databaseadvisors.com
>>> http://databaseadvisors.com/**mailman/listinfo/dba-tech<http://databaseadvisors.com/mailman/listinfo/dba-tech>
>>> Website: http://www.databaseadvisors.**com<http://www.databaseadvisors.com>
>>> 
>>> ______________________________**_________________
>>> dba-Tech mailing list
>>> dba-Tech at databaseadvisors.com
>>> http://databaseadvisors.com/**mailman/listinfo/dba-tech<http://databaseadvisors.com/mailman/listinfo/dba-tech>
>>> Website: http://www.databaseadvisors.**com<http://www.databaseadvisors.com>
>>> 
>>> 
>> ______________________________**_________________
>> dba-Tech mailing list
>> dba-Tech at databaseadvisors.com
>> http://databaseadvisors.com/**mailman/listinfo/dba-tech<http://databaseadvisors.com/mailman/listinfo/dba-tech>
>> Website: http://www.databaseadvisors.**com<http://www.databaseadvisors.com>
>> 
> 
> 
> 
> -- 
> Arthur
> Cell: 647.710.1314
> 
> Prediction is difficult, especially of the future.
>  -- Niels Bohr
> _______________________________________________
> dba-Tech mailing list
> dba-Tech at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-tech
> Website: http://www.databaseadvisors.com



More information about the dba-Tech mailing list