Welcome Guest, Not a member yet? Register   Sign In
Help with SELECT statement
#2

[eluser]bgreene[/eluser]
select t.*,a.name as appname,d.name as devname from downtime t
left join application a on a.id = t.application_id
left join device d on d.id = t.device_id

use "left join" rather than "join" because in the case of eg an invalid
device_id in the downtime table ie the value is not in the device table,
then the downtime event will still show up in your query result but with
null as devname


Messages In This Thread
Help with SELECT statement - by El Forum - 07-27-2009, 09:25 AM
Help with SELECT statement - by El Forum - 07-27-2009, 09:43 AM
Help with SELECT statement - by El Forum - 07-27-2009, 09:47 AM
Help with SELECT statement - by El Forum - 07-27-2009, 11:14 AM
Help with SELECT statement - by El Forum - 07-29-2009, 08:13 AM
Help with SELECT statement - by El Forum - 08-05-2009, 09:07 AM
Help with SELECT statement - by El Forum - 08-05-2009, 09:25 AM
Help with SELECT statement - by El Forum - 08-05-2009, 09:31 AM
Help with SELECT statement - by El Forum - 08-05-2009, 09:59 AM
Help with SELECT statement - by El Forum - 08-05-2009, 10:19 AM
Help with SELECT statement - by El Forum - 08-05-2009, 10:33 AM



Theme © iAndrew 2016 - Forum software by © MyBB