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

[ale] MySQL Question

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

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