[ale] MySQL Question
James Sumners
james at sumners.ath.cx
Thu Apr 1 09:18:05 EST 2004
As far as I understand it subqueries are not available until 4.1 which is not a
production release.
SELECT * FROM users LEFT JOIN alarms ON users.id=alarms.id WHERE alarms.id='1';
http://www.mysql.com/doc/en/JOIN.html
On Thu, 1 Apr 2004 09:08:38 -0500
"Yu, Jerry" <Jerry.Yu at Voicecom.com> 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 );
>
> or 2) define a view.
>
>
>
> -----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
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
--
I used to be interested in Windows NT, but the more I see of it the more it
looks like traditional Windows with a stabler kernel. I don't find anything
technically interesting there. In my opinion MS is a lot better at making money
than it is at making good operating systems. -- Linus Torvalds
More information about the Ale
mailing list