SQLTeam.com | Weblogs | Forums

Making a Condition to create a new table which outputs 1 or 0 based on Timediff values Query SQL

0

So for my query here according to another table I found the timediff between two fields and then created 2 new column that will output the diff between those 2 fields (start and end time). For the second part of my code I want to take those diff's and create new columns that basically tells if the diffs are > 0 then that its 1 and if its = or < 0 then its 0. So basically the last 2 column for the result will only have 1s or 0s...how do I make the condition for this? Just to make sure there will be a total of 6 columns when running after that condition: Expected_Start_Time, Actual_Start_Time, Difference_Start_Time, Difference_End_Time, new column with start time 1s or 0s, and column with end time 1s or 0s.

Welcome

Is this for Microsoft SQL Server?

This is for Google BigQuery

This is a Microsoft SQL Server forum. But someone that might know Google BigQuery might be able to help. But you probably will get more mileage if you posted on a Google BigQuery forum