Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hello everyone,I'm really poor in SQL language. So i need a SELECT for resolving my problem.I have such tables (MSDE)-----------------------------Table COMPUTERScompid | compnamewith records1 | computer12 | computer23 | computer3-----------------------------Table EVENTSeventid | eventtype | timestamp | compidwith records1 | 2 | 1119939932 | 12 | 1 | 1119939933 | 23 | 2 | 1119939934 | 3-----------------------------And Table EVENTSDESCRIPTIONeventtype | eventdescriptionwith records1 | Node is Down2 | Node is UP--------------------------------Now QUESTION I need to write such SQL SELECT for..Take eventtype, timestamp, compid records for last hour (for example... how to work with timestamp i know :) ) from table EVENTS, after that i need get computer names from COMPUTERS with previously obtained compid and eventdescription from EVENTSDESCRIPTION.Let's supose that i have only one record for last hour eventid -> 3My result must be "some_timestamp, computer3 Node is UP" or smth like that :-)Thanks
madhivanan
Premature Yak Congratulator
22864 Posts
Posted - 2005-06-28 : 09:27:24
Try this
Select E.eventtype , E.timestamp ,E.compid, C.compname,ED.eventDescritionfrom Events E inner join Computers C inner join EVENTSDESCRIPTION EDon ED.eventtype=E.eventtype and E.compid=C.compid where E.eventId=3