MySQL Forums
Forum List  »  MySQL Query Browser

substring to pull data twice from one field
Posted by: carlo s
Date: January 04, 2010 01:38PM

So the following command is working great but I want to pull and parse data twice from the Message column:

------------
select ReceivedAt, substring(Message,POSITION('access' in Message)+35, POSITION('/'in Message)-17)as Outside from SystemEvents
where Message like'%denied%'
and DATE(ReceivedAt) = DATE(NOW())
order by ReceivedAt DESC
------------

Output Looks Like

ReceivedAt ------------------- Outside
2010-01-04 13:50:40 -- 219.136.22.29(80)
2010-01-04 12:22:40 -- 66.136.42.29(80)

------------

I would like to pull data twice from the Message field with the following command but when I run the query I get the following error.
(Operand should contain 1 column(s)Error# 1241)


select ReceivedAt, substring(Message,POSITION('access' in Message)+35, POSITION('/'in Message)-17)as Outside, (Message,POSITION('access' in Message)+20, POSITION('/'in Message)-15)as Port from SystemEvents;
where Message like'%denied%'
and DATE(ReceivedAt) = DATE(NOW())
order by ReceivedAt DESC
------------

So how do I pull data twice from one field and print it correctly.

It should look like this:

ReceivedAt ---------------- Outside ------------ Port
2010-01-04 13:50:40 -- 219.136.22.29(80) -- 443

thx

Options: ReplyQuote


Subject
Written By
Posted
substring to pull data twice from one field
January 04, 2010 01:38PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.