sql - How to select data in same table on different line that are empty? -


i have these 3 tables (i attach preview). , of end of list example of data in table “virustotalscans.” there column name “virustotal.“ each unique sample has number, example 165, next sample has number 166 , etc.

table virutotals

create table virustotals (                             virustotal integer primary key,                             virustotal_md5_hash text not null,                             virustotal_timestamp integer not null,                             virustotal_permalink text not null                     ); create index virustotals_md5_hash_idx                     on virustotals (virustotal_md5_hash); 

table virustotalscans

create table virustotalscans (                     virustotalscan integer primary key,                     virustotal integer not null,                     virustotalscan_scanner text not null,                     virustotalscan_result text             ); create index virustotalscans_result_idx                     on virustotalscans (virustotalscan_result); create index virustotalscans_scanner_idx                     on virustotalscans (virustotalscan_scanner); create index virustotalscans_virustotal_idx                     on virustotalscans (virustotal); 

table downloads

create table downloads (                             download integer primary key,                             connection integer,                             download_url text,                             download_md5_hash text                             -- constraint downloads_connection_fkey foreign key (connection) references connections (connection)                     ); create index downloads_connection_idx   on downloads (connection); create index downloads_md5_hash_idx                     on downloads (download_md5_hash); create index downloads_url_idx                     on downloads (download_url); 

example of data in table “virustotalscans”: http://pastebin.com/7e7mczwt

now, need select samples, on lines in column “virustotalscan_result” empty. need select samples, don´t detect virustotal antivirus. tried select:

select distinct downloads.download_md5_hash virustotalscans, virustotals,     downloads  downloads.download_md5_hash = virustotals.virustotal_md5_hash ,     virustotals.virustotal = virustotalscans.virustotal ,     virustotalscans.virustotalscan_result null; 

but md5 hashes of samples... reason samples contain @ least 1 line, empty. logical because, antivirus doesn’t detect sample.

the better example: http://pastebin.com/y81dppmq. need select sample - number (column virustotal), lines empty in column virustotalscan_result. can example number 2.

can me please?

thank replies.

select download_md5_hash downloads join virustotals on download_md5_hash = virustotal_md5_hash virustotal in (select virustotal                      virustotalscans                      group virustotal                      having count(virustotalscan_result) = 0) 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -