-
UPDATE redesign.student SET student_work_area_other SELECT
-
REPLACE('anywhere,(.*)', '$1', i.work_area) AS regexp_col FROM
-
mycompany.interns i, redesign.student s WHERE i.unique_key =
-
s.unique_key GROUP BY work_area
-
Of course this does not work, but I have no idea what the MySQL
equivalent will be to something like this.
I basically want to take out PART of a column field value and update it
into another database table. How is that done?
Thanx
Phil 4 1600
<ph************ **@gmail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. . - UPDATE redesign.student SET student_work_area_other SELECT
- REPLACE('anywhere,(.*)', '$1', i.work_area) AS regexp_col FROM
- mycompany.interns i, redesign.student s WHERE i.unique_key =
- s.unique_key GROUP BY work_area
-
Of course this does not work, but I have no idea what the MySQL equivalent will be to something like this.
UPDATE redesign.studen t AS s, mycompany.inter ns AS i
SET s.student_work_ area_other = REPLACE(i.work_ area, 'anywhere,', '')
WHERE i.unique_key = s.unique_key
You had the order of arguments wrong in the REPLACE function. Also, REPLACE
doesn't understand regular expressions or positional parameters; it only
does fixed strings. But in this case the change you need to make can be
done with fixed strings.
I can't tell what your GROUP BY is intended to do in this query. It seems
irrelevant.
Regards,
Bill K.
See below, thanx
Bill Karwin wrote: <ph************ **@gmail.com> wrote in message news:11******** **************@ g49g2000cwa.goo glegroups.com.. . - > UPDATE redesign.student SET student_work_area_other SELECT
- > REPLACE('anywhere,(.*)', '$1', i.work_area) AS regexp_col FROM
- > mycompany.interns i, redesign.student s WHERE i.unique_key =
- > s.unique_key GROUP BY work_area
- >
Of course this does not work, but I have no idea what the MySQL equivalent will be to something like this. UPDATE redesign.studen t AS s, mycompany.inter ns AS i SET s.student_work_ area_other = REPLACE(i.work_ area, 'anywhere,', '') WHERE i.unique_key = s.unique_key
You had the order of arguments wrong in the REPLACE function. Also, REPLACE doesn't understand regular expressions or positional parameters; it only does fixed strings. But in this case the change you need to make can be done with fixed strings.
I can't see how, because I need the content after the word "anywhere",
and NONE of the conent up to and including "anywhere"; how can a fixed
string REPLACE do that?
I can't tell what your GROUP BY is intended to do in this query. It seems irrelevant.
Regards, Bill K.
<ph************ **@gmail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. . I need the content after the word "anywhere", and NONE of the conent up to and including "anywhere"; how can a fixed string REPLACE do that?
Aha - I didn't understand the requirements from your nonsense code above.
Well, perhaps you'll have to get more creative.
There are many functions available to you in MySQL.
LOCATE and SUBSTRING are a couple of good ones.
See http://dev.mysql.com/doc/refman/5.0/...functions.html
I'll leave it to you to figure out how to utilize them in this case. I
think it's a bad idea for you to take examples from newsgroup postings and
run them without understanding them.
Good luck,
Bill K.
Thanks to you and another DBA (Sybase DBA), this one got solved (I
couldn't have come up with this one to save my life):
update student_db.stud ent s
set s.application_a rea_other = (
select SUBSTRING(i.app lication_area, LOCATE('anywher e',
i.application_a rea) + LENGTH('anywher e') + 2) as regexp_col
from olddb.applicant i
where s.unique_key = i.unique_key
)
Phil
Bill Karwin wrote: <ph************ **@gmail.com> wrote in message news:11******** **************@ g49g2000cwa.goo glegroups.com.. . I need the content after the word "anywhere", and NONE of the conent up to and including "anywhere"; how can a fixed string REPLACE do that?
Aha - I didn't understand the requirements from your nonsense code above.
Well, perhaps you'll have to get more creative. There are many functions available to you in MySQL. LOCATE and SUBSTRING are a couple of good ones. See http://dev.mysql.com/doc/refman/5.0/...functions.html
I'll leave it to you to figure out how to utilize them in this case. I think it's a bad idea for you to take examples from newsgroup postings and run them without understanding them.
Good luck, Bill K. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Peter |
last post by:
My problem is the last bit of coding below, the like statement does not
work. what I have is a product options field and in it is stored characters
i.e. "avcy" etc what the query does is that if I type in any single
character all the products that match the criteria should be displayed. So
if I typed in an "a" I should get 3 returns (see below) Fields could look
like this:
product.options:
bhw
djhsa
|
by: sathya |
last post by:
hi,
i have problem in httphandler, my problem is that when i am trying to
use server.execute(/default.aspx) i am getting error....
Here i am trying to redirect from home.aspx to default.aspx (both file
isin sharepoint).I have give a copy of my code below..
|
by: sathya |
last post by:
hi,
i have problem in httphandler, my problem is that when i am trying to
use server.execute(/default.aspx) i am getting error....
Here i am trying to redirect from home.aspx to default.aspx (both file
isin sharepoint).I have give a copy of my code below..
|
by: phillip.s.powell |
last post by:
Now I have another SQL query for MySQL I can't figure out!! This is
overwhelming me completely and I also must have this figured out today
and I can't figure it out!!
UPDATE student_db.student
SET has_letter1 = (
SELECT i.letter1 FROM olddb.student i, student_db student s WHERE
s.unique_key = i.unique_key
)
|
by: John Austin |
last post by:
I need to understand why if I add a control and use AddHandler to connect its
click event, it will work in Page_Load, but not in a Button_Click.
The idea is that the user types some data, presses the button, gets a list
of results (each with a LinkButton) and can then press one of the link
buttons to get further information. The newly added link buttons appear, but
the click event added with AddHandler does not fire.
A control added in...
| |
by: archana |
last post by:
Hi all,
I want to send webrquest throguh anonymous proxy.
Can anyone tell me how to validate ip address and port number of
anonynmous proxy server.
Is it using TctpClient class ?
And while sending request through anonymous proxy if ip address of that
|
by: JHNielson |
last post by:
I Know I've posted an Urgent message before. But I'm in the middle of system testing, and these little stupid bugs are killing me......
I have a query that checks that a set of values (the values in 6 fields) are actually equal to the total they submitted on the form.
The fields are set to Double with Auto for # decimal places. But I've also tried it with them set to 2-Decimal places.
The SQL query looks like this:
UPDATE ETL_TBL...
|
by: jats |
last post by:
I am a .NET programmer and i had recently got a web application designed in Classic ASP, to make some modifications.
When i run the application and try to create a new user the following error pops up. "The email address you entered already exists."
Now my problem is i am not able to find out the where the error is generating or why as the datdabase table is completely empty (no records)
Below is the code...
++++++++++++++++++
<%
|
by: Hamayun Khan |
last post by:
HI All
My client requirements are such that I m going to generate query runtime in asp.net.
At some time the query reaches to very much length as below
SELECT tblJobPost.JobTitle,tblJobPost.JobDesc,Scraped,tblSchools.logoimage,tblJobPost.JobPostID,tblJobPost.SchoolID,tblSchools.web,cast(tblJobPost.MemType as nvarchar(255)) as MemType,tblSchools.InstitutionName,tblSchools.InstitutionName as Empname,tblJobPost.PayScale,cast(tblLEA.LEA...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |