[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



SELECT * FROM users LEFT JOIN alarms ON users.id=alarms.id WHERE alarms.id='1';

<a  rel="nofollow" href="http://www.mysql.com/doc/en/JOIN.html";>http://www.mysql.com/doc/en/JOIN.html</a>

On Thu, 1 Apr 2004 09:08:38 -0500 
&quot;Yu, Jerry&quot; &lt;Jerry.Yu at Voicecom.com&gt; wrote:

&gt; Not sure what exactly do you mean by 'to speed this up'...
&gt; 
&gt; 
&gt; To answer the question of 'consolidate into one SQL statement&quot;
&gt; 1) use subqueries:
&gt; select * from users where ID in ( select User_ID from ALARMS where ID = 1 );
&gt; 
&gt; or 2) define a view.
&gt; 
&gt; 
&gt; 
&gt; -----Original Message-----
&gt; From: Christopher Fowler [<a  rel="nofollow" href="mailto:cfowler";>mailto:cfowler</a> at outpostsentinel.com]
&gt; Sent: Thursday, April 01, 2004 9:04 AM
&gt; To: ale at ale.org
&gt; Subject: [ale] MySQL Question
&gt; 
&gt; 
&gt; I do the following select statements to get a username out of a
&gt; database.
&gt; 
&gt; SELECT USER_ID from ALARMS where ID = 1;
&gt; SELECT * from USERS where ID = '&lt;USER_ID from above&gt;';
&gt; 
&gt; I want to speed this up.  Can I consolidate into one SQL statement?
&gt; 
&gt; 
&gt; 
&gt; _______________________________________________
&gt; Ale mailing list
&gt; Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>
&gt; _______________________________________________
&gt; Ale mailing list
&gt; Ale at ale.org
&gt; <a  rel="nofollow" href="http://www.ale.org/mailman/listinfo/ale";>http://www.ale.org/mailman/listinfo/ale</a>


-- 

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


</pre>
<!--X-Body-of-Message-End-->
<!--X-MsgBody-End-->
<!--X-Follow-Ups-->
<hr>
<ul><li><strong>Follow-Ups</strong>:
<ul>
<li><strong><a name="00027" href="msg00027.html">[ale] MySQL Question</a></strong>
<ul><li><em>From:</em> kafka at antichri.st (George Carless)</li></ul></li>
</ul></li></ul>
<!--X-Follow-Ups-End-->
<!--X-References-->
<ul><li><strong>References</strong>:
<ul>
<li><strong><a name="00018" href="msg00018.html">[ale] MySQL Question</a></strong>
<ul><li><em>From:</em> Jerry.Yu at Voicecom.com (Yu, Jerry)</li></ul></li>
</ul></li></ul>
<!--X-References-End-->
<!--X-BotPNI-->
<ul>
<li>Prev by Date:
<strong><a href="msg00020.html">[ale] AOPEN Burner</a></strong>
</li>
<li>Next by Date:
<strong><a href="msg00022.html">[ale] OT:E-Commerce templates</a></strong>
</li>
<li>Previous by thread:
<strong><a href="msg00019.html">[ale] MySQL Question</a></strong>
</li>
<li>Next by thread:
<strong><a href="msg00027.html">[ale] MySQL Question</a></strong>
</li>
<li>Index(es):
<ul>
<li><a href="maillist.html#00021"><strong>Date</strong></a></li>
<li><a href="threads.html#00021"><strong>Thread</strong></a></li>
</ul>
</li>
</ul>

<!--X-BotPNI-End-->
<!--X-User-Footer-->
<!--X-User-Footer-End-->
</body>
</html>