Advertisement
Guest User

Untitled

a guest
Sep 26th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 1.16 KB | None | 0 0
  1. SELECT
  2.     sPlantName,
  3.     iPlantAge,
  4.     PlantPrice,
  5.     CONCAT (
  6.         REPLACE (
  7.             REPLACE (
  8.                 FORMAT (PlantPrice, 2), ',' ,' '
  9.             ),'.',','
  10.         ),'р.'
  11.     ) as PlantPrice2,
  12.     sPlantTypeName,
  13.     if (
  14.         LOCATE ('before', PlantHeight),
  15.         CONCAT (
  16.             'до ',REPLACE (PlantHeight,' before','')
  17.         ), if (
  18.             LOCATE ('after', PlantHeight),
  19.             CONCAT (
  20.                 REPLACE (PlantHeight,' after',''), ' и выше'
  21.             ),
  22.             PlantHeight
  23.         )
  24.     ) as PlantHeight,
  25.     if (
  26.         LOCATE ('before', PlantHeight) or LOCATE ('after', PlantHeight),
  27.         (
  28.                 REPLACE (
  29.                         REPLACE (
  30.                                 PlantHeight, ' after', ''
  31.                         ), ' before', ''
  32.                 ) - REPLACE (
  33.                         REPLACE (
  34.                                 PlantHeight, ' after',''
  35.                        ), ' before', ''
  36.                 ) * 0.01
  37.         ),
  38.         PlantHeight
  39.     ) as PlantHeight2
  40.  
  41. FROM
  42.     `plants`
  43. LEFT JOIN
  44.     plantTypes
  45. ON
  46.     idPlantType = eiPlantType
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement