List:General Discussion« Previous MessageNext Message »
From:¿n©_ ¡E¢X ¡¸ Date:December 18 2003 3:44pm
Subject:Re: Query Help 2
View as plain text  
yes, it should work, but should not be 1,1 ?

or simply:

UPDATE RemoteStation SET company=LEFT(ID, 4);  ?


"gerald_clark" <gerald_clark@stripped> wrote in message
news:3FE1B9F4.3000808@ style="color:#666">stripped...
> How about:
> update RemoteStation set company=substring(ID,1,1);
>
> Jeff McKeon wrote:
>
> >Damn fat fingers and MS Outlook.  I sent the "Query Help" message before
> >I was finishes typing.  Sorry...
> >
> >I have two tables, customer table and a company table
> >
> >The customer table has an ID field that is 8 characters long.  The first
> >4 characters are the company code.
> >
> >We just added a company table that has an id field that contains that
> >companies id code.  We also added a field to the customer table that
> >will hold the company ID that the customer belongs to.  So.....
> >
> >Customer table
> >
> >ID name company
> >12347771 joe null
> >12347772 mary null
> >43210001 bob null
> >
> >Company Table
> >
> >ID name
> >1234 Acme
> >4321 Acme_Europe
> >
> >What I now need to do is create an update statement that will match the
> >customer to the company by substring(Customer.ID,1,4) to Company.ID
> >
> >I tried:
> >
> >update RemoteStation set Company_ID=Company.ID where
> >substring(Company_ID,1,4) like Company.ID;
> >
> >But it didn't work.  Any suggestions?
> >
> >Thanks for the help,
> >
> >Jeff
> >
> >
> >
>
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
http://lists.mysql.com/mysql?unsub=1
>
>



Thread
Query Help 2Jeff McKeon18 Dec
  • Re: Query Help 2gerald_clark18 Dec
  • Re: Query Help 2cktsoi18 Dec
  • Re: Query Help 2gerald_clark18 Dec
  • Re: Query Help 2cktsoi19 Dec