[ale] MySQL Question

Christopher Fowler cfowler at outpostsentinel.com
Thu Apr 1 09:16:12 EST 2004


On Thu, 2004-04-01 at 09:08, Yu, Jerry wrote:
> Not sure what exactly do you mean by 'to speed this up'...
> 
> 
> To answer the question of 'consolidate into one SQL statement"
> 1) use subqueries:
> select * from users where ID in ( select User_ID from ALARMS where ID = 1 );
> 
Awesome.  I did not know that MySQL supported sub quesries like that.  I
thought in the past it was not supported.

> or 2) define a view.
> 

Good idea too.

> 
> 
> -----Original Message-----
> From: Christopher Fowler [mailto:cfowler at outpostsentinel.com]
> Sent: Thursday, April 01, 2004 9:04 AM
> To: ale at ale.org
> Subject: [ale] MySQL Question
> 
> 
> I do the following select statements to get a username out of a
> database.
> 
> SELECT USER_ID from ALARMS where ID = 1;
> SELECT * from USERS where ID = '<USER_ID from above>';
> 
> I want to speed this up.  Can I consolidate into one SQL statement?
> 
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale



More information about the Ale mailing list