andreybotanic

roots

Apr 3rd, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.29 KB | None | 0 0
  1. select a, b, c, x1, iif(x2=x1, NULL, x2) x2
  2. from
  3. (
  4.     select *, iif(d>0, (-b+sqrt(d))/2/a, iif(d=0,-b/2/a,NULL)) x1, iif(d>0, (-b-sqrt(d))/2/a, iif(d=0,-b/2/a,NULL)) x2
  5.     from
  6.     (
  7.         select *, b*b-4*a*c d
  8.         from
  9.         (
  10.             select distinct B_Q_ID a, B_V_ID b, B_VOL c
  11.             from CTE
  12.         )t
  13.     )t
  14. )t
Advertisement
Add Comment
Please, Sign In to add comment