Home > database >  Consult multi-table query method
Consult multi-table query method

Time:09-30

Dear Daniel,

Please have a look at the following requirements of how to implement? Thank you,

There are 3 tables, its structure is as follows:




The SSB table by storage_id associated with storage_list table, nickname, such as IP column, at the same time through ssb_code associated with ssb_msg table.

Now need to joint the 3 table check get the following results (needs to be done within a SQL query) :


"Total SSB Qty" of which needs joint SSB table and storage_list table, "New SSB Today" need joint SSB table and storage_list table, and on the date as an additional filter conditions, "Critical SSB Today" be three tables together, with the date and specify ssb_msg. Severity="Critical" as an additional filter conditions,

Thank you!

CodePudding user response:

 
SELECT storage. Nickname, storage_list. IP FROM SSB storage_list, ssb_msg
WHERE SSB. Storage_id=storage_list. Storage_id
AND SSB. Ssb_code=SSB. Ssb_code
AND ssb_msg. Serverity='Critical'
AND to_days (now ())=to_days (SSB) ssb_capture_time)

CodePudding user response:

Thank you,

The output is wrong, and not need several numerical statistics,
  • Related