I would like to select a field but only under specific circumstance, otherwise i would like it to just be blank or null. Example
Select
a.Name,
c.Hat as FancyHat,
b.Shirt,
b.Shoes,
c.Hat
from
directory a, store b, superHatStore c
where
a.key = b.key
a.key = c.key
now I would only want to display a FancyHat name if it is a ‘fancy_hat’ example
where
c.Type = 'fancy_hat'
but if I put it in the where clause it is too restrictive… because I also want the name of the hat to be in another field regardless of hat type… maybe I am just doing something wrong. Any suggestions would be greatly appreciated, Thanks
For MS-Access you can use either the
IIFstatementhttp://www.techonthenet.com/access/functions/advanced/iif.php
or the
CASEstatement (if you’re using VBA)http://www.techonthenet.com/access/functions/advanced/case.php
EDIT: So if I’m reading correctly you want (UNTESTED!):