SHARE
TWEET

Untitled

a guest Mar 16th, 2017 56 in 13 hours
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WITH T1 as ( SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, 6 AS FormuleId, null AS OptionId UNION
  2.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 102 AS OptionId UNION
  3.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 103 AS OptionId UNION
  4.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 104 AS OptionId UNION
  5.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 105 AS OptionId UNION
  6.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 106 AS OptionId UNION
  7.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 110 AS OptionId UNION
  8.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 111 AS OptionId UNION
  9.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 112 AS OptionId UNION
  10.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 113 AS OptionId UNION
  11.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 114 AS OptionId UNION
  12.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 115 AS OptionId UNION
  13.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 116 AS OptionId UNION
  14.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 117 AS OptionId UNION
  15.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 118 AS OptionId UNION
  16.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 119 AS OptionId UNION
  17.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 120 AS OptionId UNION
  18.  SELECT 1 AS [index], 40 AS _Date_de_naissance20161206155920933, 'médical' AS _CSP20161206155920933, 'Alsace Moselle' AS _Regime20161206155920933, NULL AS FormuleId, 121 AS OptionId)  
  19. SELECT
  20.                                 T1.[Index] AS [Index],
  21.                                 T2.formuleId,
  22.                                 T2.optionId,
  23.                                 T2.Montant
  24.                             FROM
  25.                                 Tarification_UNIM_Sante___MODULE_20161207041004 AS T2
  26.                             INNER JOIN PeriodeValiditeTarif
  27.                             ON PeriodeValiditeTarif.ID = T2.periodeID
  28.                             INNER JOIN T1
  29.                             ON (T2._CSP20161206155920933 = T1._CSP20161206155920933) AND (T2._Regime20161206155920933 = T1._Regime20161206155920933) AND (T2._Date_de_naissance20161206155920933 = T1._Date_de_naissance20161206155920933)
  30.                                 AND (T1.FormuleId = T2.FormuleId OR (T1.FormuleId IS NULL AND T2.FormuleId IS NULL))
  31.                                 AND (T1.OptionId = T2.OptionId OR (T1.OptionId  IS NULL AND T2.OptionId  IS NULL))
  32.                             WHERE
  33.                                 Montant IS NOT NULL AND PeriodeValiditeTarif.DateDebut <= '01-04-2017' AND ISNULL(PeriodeValiditeTarif.DateFin, '01-04-2017') >=  '01-04-2017'
  34.                              ORDER BY [Index]
RAW Paste Data
Top