How to concatenate a constant to an int?

2009-11-24 Thread Neil Aggarwal
Hello: This seems like it should be simple, but I am having trouble figuring it out. I have a table contact which has: nameString contact_id int Lets assume the contact table has this row: name: Neil Aggarwal contact_id: 1 I want to create a

Re: How to concatenate a constant to an int?

2009-11-24 Thread Michael Dykman
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 n...@jammconsulting.com wrote: Hello: This seems like it should be simple, but I am having trouble figuring it out. I have

RE: How to concatenate a constant to an int?

2009-11-24 Thread Neil Aggarwal
concat('C',c.contact_id) as ref That worked. Thanks the the tip. Now, lets say I have three tables: contact contact_id int prospect prospect_id int client client_id int If a contact is a prospect, it will have a line in both the contact and prospect table,

Re: How to concatenate a constant to an int?

2009-11-24 Thread Michael Dykman
untested, but you are looking for something like this (formatted for humans): select concat( ifnull( if(l.client_id,'L',null), ifnull( if(p.prospect_id,'P',null), 'C')), c.contact_id) as reference_number, from contact