On Thu, Jul 12, 2001 at 01:52:41PM +0100, Rich Buckley wrote:

> > SELECT MID(email, LOCATE("@", email), 999) AS domain, COUNT(*) FROM 
> > email_table GROUP BY domain;
> 
> Neat.
> 
> > I'm not sure about MID and LOCATE in other renditions of SQL though.
> 
> In Oracle MID would be SUBSTR but I cannot think of an alternative
> to LOCATE.

That would be INSTR:

  SELECT SUBSTR(email, INSTR(email, '@')), COUNT(*)
  FROM   email_table
  GROUP BY SUBSTR(email, INSTR(email, '@'))

Ronald

Reply via email to