-
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 1557
<ph**************@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.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.student AS s, mycompany.interns 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.googlegr oups.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.student AS s, mycompany.interns 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.googlegr oups.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.student s
set s.application_area_other = (
select SUBSTRING(i.application_area, LOCATE('anywhere',
i.application_area) + LENGTH('anywhere') + 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.googlegr oups.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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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...
|
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,...
|
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...
|
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...
|
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...
| |