# Multiplying the Data In 3 Table With IF Statement

Page 1 of 1

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

### #1 vher_way

Reputation: 1
• 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:

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?
/>/>/> />/>/> />/>/>

Is This A Good Question/Topic? 0

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

### #2 andrewsw

• Stealth IT

Reputation: 6700
• 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

### #3 andrewsw

• Stealth IT

Reputation: 6700
• 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.

### #4 vher_way

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

## Re: Multiplying the Data In 3 Table With IF Statement

Posted 16 November 2013 - 06:41 PM

andrewsw, 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!

But thanks before!!

andrewsw, 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.

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

### #5 andrewsw

• Stealth IT

Reputation: 6700
• 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.