SQL Basics

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesSQL Basics

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old November 11th, 2012, 02:36 AM
nvoyatzopoulos nvoyatzopoulos is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 1 nvoyatzopoulos User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 m 37 sec
Reputation Power: 0
Groups , sum ,inner join How to do it ??

Hello , i'm new and i want your help guys! I've 3 tables with one common field (id) .
the data look like this ..
companyid |datetrn |income| expenses | tax income | tax expenses |..
01 |2012/01/01|100 | 0 | 0 | 10 |..
02 |2012/02/15|0 | 150 | 12 | 0 |..
03 |2012/03/20|1500 | 1000 | 0 | 100 |..

so here start the troubles .. I want to join those 3 tables with id (ok with this) and present results like the following ..

inc. sum|exp.sum|tot.period|in.tax sum|ex.tax sum|tot.period
january | 100 | 0 | 100 | 0 | 10 | 10
february | 0 | 150 | 50 | 12 | 0 | -2
march | 1000 | 0 | 1050 | 0 | 100 | 98
........

Is this possible ?

thanks in advance !

Reply With Quote
  #2  
Old November 12th, 2012, 01:24 AM
dibyajyotibeher dibyajyotibeher is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2012
Posts: 3 dibyajyotibeher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 36 m 34 sec
Reputation Power: 0
I am not exactly getting where you have problem ...

for getting the month name you can use --

EXTRACT(MONTH FROM d) for mysql
or

TO_CHAR(d, 'MON') -> Three character month for oracle

d is the date field

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesSQL Basics > Groups , sum ,inner join How to do it ??


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

© 2003-2014 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap