Thursday, September 11, 2008

Keeping Self Confident

USE [ACCEPTABLE_PORN_PLOTS]
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

SELECT
Alexis_Towers.Dirty_Parts,
Alexis_Towers.Mood,

FROM Alexis_Towers
WHERE Mood = 'Willing" and Skill = 'Able'

UNION ALL

SELECT
Delivery_Person.Dirty_Parts,
Delivery_Person.Mood, --Note: Is this Important?

FROM Delivery_Person
LEFT OUTER JOIN
Me
ON
Delivery_Person.Sex = Me.Sex

WHERE
(
CASE
WHEN Me.Sex IS NOT NULL
AND
Delivery_Person.Dirty_Parts <= Me.Dirty_Parts
AND
Delivery_Person.Skill < Me.Skill
THEN 1
WHEN Me.Sex IS NULL THEN 1
ELSE 0
END
) = 1

No comments: