SQL JOIN EXAMPLE

12 Feb

Ref:http://www.sql-tutorial.net/SQL-JOIN.asp

The SQL JOIN clause is used whenever we have to select data from 2 or more tables.  To be able to use SQL JOIN clause to extract data from 2 (or more) tables, we need a relationship between certain columns in these tables.

My Example:

SELECT  proddta.f0911.GLKCO, proddta.f0911.GLDOC, proddta.f0911.GLDGJ, proddta.f0911.GLJELN, proddta.f0911.GLANI, proddta.f0911.GLAM, proddta.f0911.GLOBJ, proddta.f0911.GLSUB,
proddta.f0911.GLPN, proddta.f0911.GLFY, CONVERT(DECIMAL(10, 2), proddta.f0911.GLAA / 100) AS AMOUNT, proddta.f0911.GLEXA, proddta.f0911.GLEXR, proddta.f0911.GLUSER,
proddta.f0911.GLAID, proddta.f0901.GMAID, proddta.f0901.GMDL01
FROM proddta.f0911, proddta.f0901
WHERE proddta.f0911.GLAID = proddta.f0901.GMAID

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: