4 Replies - 1826 Views - Last Post: 16 November 2013 - 06:42 PM

#1 vher_way   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 31
  • Joined: 08-November 13

Multiplying the Data In 3 Table With IF Statement

Posted 16 November 2013 - 05:00 PM

Hello Buddy!
I want to know how to do multiplication 3 tables of data from sql.
Here we go ..
I have 3 tables:
++ T_Mahasiswa
++ T_BBM
++ T_PPA
For more details, you can see the image below:


Attached Image

Attached Image

Attached Image

You see the picture?

I want to multiply the value of IPK on the table T_Mahasiswa with B1ScorePanitia on T_BBM OR B2ScorePanitia on T_PPA depends on JenisBeasiswa on T_Mahasiswa.
If JenisBeasiswa on T_Mahasiswa is BBM then multiply IPK with B1ScorePanitia on T_BBM.

An example :
I have a GPA (3.8) in T_Mahasiswa, because the the value of JenisBeasiswa = PPA Then
3.8 * 23 334.
How To Do That?
:beta1:/>/>/> :helpsmilie:/>/>/> :helpsmilie:/>/>/>

Is This A Good Question/Topic? 0
  • +

Replies To: Multiplying the Data In 3 Table With IF Statement

#2 andrewsw   User is offline

  • Stealth IT
  • member icon

Reputation: 6700
  • View blog
  • Posts: 27,542
  • Joined: 12-December 12

Re: Multiplying the Data In 3 Table With IF Statement

Posted 16 November 2013 - 05:18 PM

you need to use, and understand, joins between these tables.

Understanding joins :sitepoint

the docs - join syntax
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is offline

  • Stealth IT
  • member icon

Reputation: 6700
  • View blog
  • Posts: 27,542
  • Joined: 12-December 12

Re: Multiplying the Data In 3 Table With IF Statement

Posted 16 November 2013 - 05:30 PM

It will probably help to take this approach:

  • Start by selecting columns from just two tables.
  • Introduce the third table and select a column from this.
  • Use a WHERE clause.
  • Perform the calculation you need.

Was This Post Helpful? 0
  • +
  • -

#4 vher_way   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 31
  • Joined: 08-November 13

Re: Multiplying the Data In 3 Table With IF Statement

Posted 16 November 2013 - 06:41 PM

View Postandrewsw, on 16 November 2013 - 05:18 PM, said:

you need to use, and understand, joins between these tables.

Understanding joins :sitepoint

the docs - join syntax


Oke broo.. I will learn it!!
I understand About Join, but No about IF Statement! I just understand IF in VB.Net! :hammer:

But thanks before!! :bananaman:

View Postandrewsw, on 16 November 2013 - 05:30 PM, said:

It will probably help to take this approach:

[list]

[*]Start by selecting columns from just two tables.
[*]Introduce the third table and select a column from this.
[*]Use a WHERE clause.
[*]Perform the calculat


Yeah nice sugestion!
I don't understand about If. But i will try it, if I have problem with my Query, i will post again.. and please help!
Okee.. Thanks Dude. :rockon:

This post has been edited by andrewsw: 16 November 2013 - 06:43 PM
Reason for edit:: Fixed quote

Was This Post Helpful? 0
  • +
  • -

#5 andrewsw   User is offline

  • Stealth IT
  • member icon

Reputation: 6700
  • View blog
  • Posts: 27,542
  • Joined: 12-December 12

Re: Multiplying the Data In 3 Table With IF Statement

Posted 16 November 2013 - 06:42 PM

There are no if-statements involved. Joins and a WHERE clause will return the data you need.

Good luck.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1