<?php
$instruction = "bq query --replace --allow_large_results
--destination_table=ShowByNumbers.SBN \"SELECT 'Chicago Fire' as Show,
'NBC' as Network,'2016-10-15' as Start_Date, '2016-10-10' as End_Date,
COUNT(UNIQUE( TV_ID )) as Audience_Size FROM Partition_Analysis.BaseTable
WHERE _PARTITIONTIME BETWEEN TIMESTAMP('2016-10-15') AND
TIMESTAMP('2016-10-10') AND CAST(content_recognition_end_timestamp AS float)
- CAST(content_recognition_start_timestamp AS float) > 15000000 AND
network_callsign != 'INFOMERCIAL' AND Content_title='Chicago Fire' AND
Network_CallSign IN (SELECT Network_CallSign FROM
Partition_Analysis.network_mapping WHERE Network= 'NBC')\"";
echo exec($instruction);
?>
When I run this PHP command I don't get any output.
When I go over to google big query, in my query history, it shows that the actual command that was being executed was:
SELECT 'Chicago Fire' as Show, 'NBC' as Network,'2016-10-15' as Start_Date, '2016-10-10' as End_Date,
COUNT(UNIQUE( TV_ID )) as Audience_Size FROM Partition_Analysis.BaseTable
WHERE _PARTITIONTIME BETWEEN TIMESTAMP('2016-10-15') AND TIMESTAMP('2016-10-10')
AND CAST(content_recognition_end_timestamp AS float) - CAST(content_recognition_start_timestamp AS float)
AND network_callsign != 'INFOMERCIAL' AND Content_title='Chicago Fire'
AND Network_CallSign IN (SELECT Network_CallSign
FROM Partition_Analysis.network_mapping WHERE Network= 'NBC')
If you notice, the >15000000 is missing over there.
Why isn't the exec command reading >15000000 in the query?