MySQL Forums
Forum List  »  Newbie

Re: Select * with a function applied to one column
Posted by: Rick James
Date: December 06, 2014 10:51AM

I see no downside (relative to the alternatives) of SELECT * into an associative array. Do you, Phill?

Dean, yes, many subqueries are performance issues. Some subqueries actually improve performance; they usually involve a GROUP BY or LIMIT, with the complexity (JOIN, etc) carefully split between the subquery and the outer query. In your particular case, I predict a slight performance hit.

> convert all mentions of column ip to column converted_ip in the code

How about a short code kludge:
$assoc_array = ..."SELECT ... AS converted_ip ..."
$assoc_array['id'] = $assoc_array['converted_ip']; -- add this one-liner.
(It's not as clean as your suggestions, but it is only one line.)

Options: ReplyQuote


Subject
Written By
Posted
Re: Select * with a function applied to one column
December 06, 2014 10:51AM


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.