Conditional column extraction

One way out of 100 ways I am sure :)

Select[A, MemberQ[#, 0] &][[All, {1, 3}]]

Mathematica graphics

Or you could just delete the zeros

DeleteCases[Select[A, MemberQ[#, 0] &], 0, {2}]

Mathematica graphics


If column 2 is binary, you can use

Pick[A[[All, {1, 3}]], A[[All, 2]], 0] (* or *)

Extract[A, Position[A[[All, 2]], 0], #[[{1, 3}]] &] (* or *)

A[[PositionIndex[A[[All, 2]]]@0, {1, 3}]]

to get

{{1, 9}, {5, 6}, {7, 11}}

In general, you can wrap column 2 with Unitize:

Pick[A[[All, {1, 3}]], Unitize @ A[[All, 2]], 0]

Extract[A, Position[Unitize @ A[[All, 2]], 0], #[[{1, 3}]] &]

A[[PositionIndex[Unitize[A[[All, 2]]]]@0, {1, 3}]]

I have a thing for Cases lately:


Cases[A,{PatternSequence[a_,0,b_]}:>{a,b}]

(* {{1,9},{5,6},{7,11}} *)

Nasser accurately points out that this is equivalent (& much more apt for code-golfing!):


Cases[A,{a_,0,b_}:>{a,b}]