954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

editing raw data from sql

hi
I want to fetch data from sql and use them to make a new data
I really like to store the records in variables and maybe do some operations on some of them ,
but the main point is to update three tables in ways that are not the same,
that means I need the raw data !

loving3232
Light Poster
25 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 
use them to make a new data


What exactly you are trying to do ?
are you trying to implement some encryption algorithm ?

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

no not an encryption
I want to decide what to do due to the data values !

loving3232
Light Poster
25 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

What do you mean by raw data? Querying the tables into a DataSet object is about as raw as it gets.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 
I want to decide what to do due to the data values !


i really did not understand.

can you post some sample data for reference.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

yes it is
see,
I have three tables,I want to change a value on one table according to data changes on the others
one will for example increase and the other will decrease

loving3232
Light Poster
25 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

are the tables related ?

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

yes they are related by a primary key

loving3232
Light Poster
25 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

if you wan to automate the process, a trigger will do the trick for you .

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

what do you mean ?
how can i use that trigger ?

loving3232
Light Poster
25 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

since the tables are related, once the data in the master table changes its dependent records can be made to change accordingly (by implementing some business logic) using a trigger.

can you please post your table structure for reference.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

the names and fields are in my language
but I'll show you how they are

SELECT
    شناسه
    , نوع برنج
    , قیمت هر کیلو
    , مقدار خرید به کیلو
    , تاریخ خرید
    , نحوه پرداخت
    , قیمت تمام شده
FROM
    rice.خريد;

SELECT
    شناسه
    , نوع برنج
    , قیمت هر کیلو خرید
    , قیمت هر کیلو فروش
    , مقدار فروش به کیلو
    , تاریخ فروش
    , نحوه پرداخت
    , پیش قسط
    , باقیمانده پول با احتساب سود
    , کل قیمت فروش
    , سود حاصل از فروش
FROM
    rice.فروش;

SELECT
    شناسه
    , نوع برنج
    , موجودی انبار
    , قیمت فروش
FROM
    rice.موجودی;


hope you can understand them :(

loving3232
Light Poster
25 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 
hope you can understand them :(


How ?

you can rename the tables to A ,B,C and post the structure and their relations.

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

table one :
Id (primary key)
name
buying price
amount
buying date
full price

table two :
Id (primary key)
name
buying price
selling price
amount
selling date
full price


table three:
Id (primary key)
name
amount remaining
selling price
**********************************

they are related by Id
I should mention that , I want table three to be changed when I sell or buy
the amount is important

loving3232
Light Poster
25 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

why the fields

name
buying price

are repeating in both the tables ?

are you trying to create something like inventory management, where you maintain the incoming and outgoing stock and finally prepare reports on the transaction on periodic basic ?

debasisdas
Posting Genius
6,872 posts since Feb 2007
Reputation Points: 666
Solved Threads: 434
 

yes I am

loving3232
Light Poster
25 posts since Sep 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: