1:  USE releasebeat;
   2:  DELIMITER $$
   3:  CREATE DEFINER = 'root'@'%'
   4:  PROCEDURE GetUserRight(IN Email1 VARCHAR(255))
   5:  SELECT
   6:    *
   7:  FROM
   8:    releasebeat.aspnet_users
   9:    LEFT JOIN
  10:    (SELECT
  11:      releasebeat.payment.i AS payment_i,
  12:      releasebeat.payment.touser,
  13:      releasebeat.payment.startdate AS payment_startdate,
  14:      releasebeat.payment.stopdate AS payment_stopdate,
  15:      releasebeat.payment.current AS payment_current,
  16:      releasebeat.payment.updatetime AS payment_update,
  17:      releasebeat.tarif.i AS tarif_i,
  18:      releasebeat.tarif.kbytes AS tarif_kbytes,
  19:      releasebeat.tarif.name AS tarif_name,
  20:      releasebeat.tarif.cost AS tarif_cost
  21:    FROM
  22:      releasebeat.payment
  23:      JOIN releasebeat.tarif
  24:        ON releasebeat.tarif.i = releasebeat.payment.totarif
  25:    WHERE
  26:      DATEDIFF(stopdate, NOW()) > 0 AND
  27:      current < kbytes
  28:    ORDER BY
  29:      releasebeat.payment.i DESC
  30:    LIMIT
  31:      1)
  32:    AS X
  33:      ON releasebeat.aspnet_users.i = X.touser
  34:  WHERE
  35:    releasebeat.aspnet_users.Email = Email1
  36:  ORDER BY
  37:    `i` DESC
  38:  LIMIT
  39:    1
  40:  $$
  41:  DELIMITER ;
'

Comments ( )
Link to this page: //www.vb-net.com/SqlServer/Proc1.htm
< THANKS ME>