List:General Discussion« Previous MessageNext Message »
From:Michael Dykman Date:November 25 2009 12:09am
Subject:Re: How to concatenate a constant to an int?
View as plain text  
 create or replace view
 view_AllData as
 select
        c.name,
        concat('C',c.contact_id) as ref
 from contact c


On Tue, Nov 24, 2009 at 6:52 PM, Neil Aggarwal <neil@stripped> wrote:
> Hello:
>
> This seems like it should be simple, but I am having trouble
> figuring it out.
>
> I have a table contact which has:
>        name            String
>        contact_id      int
>
> Lets assume the contact table has this row:
>        name: Neil Aggarwal
>        contact_id: 1
>
> I want to create a view that has this data
>        name: Neil Aggarwal
>        ref: C1
>
> I did this:
>
> create or replace view
> view_AllData as
> select
>        c.name
>        ('C'+c.contact_id) as ref,
> from contact c
>
> but the ref does not have the leading 'C' in
> the front of it.
>
> Any ideas?
>
> Thanks,
>        Neil
>
> --
> Neil Aggarwal, (281)846-8957, http://UnmeteredVPS.net
> Host Joomla!, Wordpress, phpBB, or vBulletin for $25/mo
> Unmetered bandwidth = no overage charges, 7 day free trial
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/mysql?unsub=1
>
>



-- 
 - michael dykman
 - mdykman@stripped

"May you live every day of your life."
    Jonathan Swift

Larry's First Law of Language Redesign: Everyone wants the colon.
Thread
How to concatenate a constant to an int?Neil Aggarwal25 Nov
  • Re: How to concatenate a constant to an int?Michael Dykman25 Nov
    • RE: How to concatenate a constant to an int?Neil Aggarwal25 Nov
      • Re: How to concatenate a constant to an int?Michael Dykman25 Nov