daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Dec 13th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SET @runtot:=0;
  2.  
  3. SET @itemname:=NULL;
  4.  
  5. CREATE TABLE d1 AS
  6.   (SELECT q1.id,
  7.           q1.itemname,
  8.           q1.purchase,
  9.           q1.sale,
  10.           CASE
  11.             WHEN @itemname = q1.itemname THEN @runtot := @runtot + ( q1.purchase
  12.                                                                      +
  13.                                                                    q1.sale )
  14.             ELSE @runtot := ( q1.purchase + q1.sale )
  15.           end                      AS ClosingBalance,
  16.           @itemname := q1.itemname AS Item
  17.    FROM   (SELECT id       AS ID,
  18.                   itemname AS ItemName,
  19.                   purchase AS Purchase,
  20.                   sale     AS Sale
  21.            FROM   itemledger
  22.            ORDER  BY itemname) AS q1)
  23.    
  24. Dim connectionString9921 = "Data Source=localhost;port=3306;Initial Catalog=hasna;User Id=root;password=''; Convert Zero Datetime=True"
  25.  
  26.     Dim query9921 = "CREATE TABLE D1 AS (SELECT q1.ID,q1.ItemName,q1.Purchase,q1.Sale, CASE WHEN @itemname=q1.ItemName THEN @runtot := @runtot + (q1.Purchase + q1.Sale) ELSE @runtot:=(q1.Purchase + q1.Sale)End AS ClosingBalance, @itemname:=q1.ItemName as Item FROM (SELECT ID AS ID,ItemName AS ItemName,Purchase AS Purchase,Sale AS Sale  FROM  itemledger ORDER  BY ItemName) AS q1) "
  27.  
  28.  
  29.     Using connection9921 As New MySqlConnection(connectionString9921)
  30.         Dim command As New MySqlCommand(query9921, connection9921)
  31.  
  32.         command.Parameters.AddWithValue("@runtot", "0")
  33.         command.Parameters.AddWithValue("@itemname", "NULL")
  34.         command.Connection.Open()
  35.         command.ExecuteNonQuery()
  36.         command.Connection.Close()
  37.    
  38. connectionString9921 = "Data Source=localhost;port=3306;Initial Catalog=hasna;User Id=root;password=''; Convert Zero Datetime=True"
  39.    
  40. connectionString9921 = "server=localhost;user id=root;database=(your database);Convert Zero DateTime=True"
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top