• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 196
  • Last Modified:

Using an OR operator in a SQL statement

Bit of a mental block on this!!

I have a function with a select statement in it. One of the tables has two fields in in "Transport_driven_by" CHAR(3) and "Transport_Driver" BIT.

I want to return a 1 in my select statement if EITHER Transport is not null OR Transport_driver = 1 - Otherwise return a Zero.

Thus

Select placement_ID, Booking_ID (ETC), [statement re above] as Transport, Person_ID (ETC) from tbl_placements

Can anyone help please?
0
pauldonson
Asked:
pauldonson
1 Solution
 
adatheladCommented:
Select placement_ID, ......,
     CASE WHEN Transport IS NOT NULL OR Transport_driver = 1 THEN 1 ELSE 0 END AS Transport, Person_ID
FROM tbl_placements
     
0
 
pauldonsonAuthor Commented:
Perfect, thanks for the quick response.
0

Featured Post

Microsoft Certification Exam 74-409

VeeamĀ® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now