Re: Query Help 2

2003-12-19 Thread cktsoi
yes, just a typing mistakes~~
anyway, both of them work fine.

gerald_clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 DId I type that?
 I meant 1,4
 I left it as substring because that was what he tried.

 ¿n©_ ¡E¢X ¡¸ wrote:

 yes, it should work, but should not be 1,1 ?
 
 or simply:
 
 UPDATE RemoteStation SET company=LEFT(ID, 4);  ?
 
 
 gerald_clark [EMAIL PROTECTED] wrote in message
 news:[EMAIL PROTECTED]
 
 
 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/[EMAIL PROTECTED]
 
 
 
 
 
 
 
 
 
 



 -- 
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]






-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Query Help 2

2003-12-18 Thread Jeff McKeon
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  namecompany
12347771joe null
12347772marynull
43210001bob null

Company Table

ID  name
1234Acme
4321Acme_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/[EMAIL PROTECTED]



Re: Query Help 2

2003-12-18 Thread gerald_clark
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  namecompany
12347771joe null
12347772marynull
43210001bob null
Company Table

ID  name
1234Acme
4321Acme_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/[EMAIL PROTECTED]


Re: Query Help 2

2003-12-18 Thread ¿n©_ ¡E¢X ¡¸
yes, it should work, but should not be 1,1 ?

or simply:

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


gerald_clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 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/[EMAIL PROTECTED]






-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Query Help 2

2003-12-18 Thread gerald_clark
DId I type that?
I meant 1,4
I left it as substring because that was what he tried.
¿n©_ ¡E¢X ¡¸ wrote:

yes, it should work, but should not be 1,1 ?

or simply:

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

gerald_clark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 

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/[EMAIL PROTECTED]
 

   





 



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]