SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

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 ASP Free Forums Sponsor:
  #1  
Old October 16th, 2003, 04:19 AM
erbest erbest is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 4 erbest User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Some SQL problem in displaying data

Hi, Currently i need to display information from 1 table. This is the information of the table which contain 3 fields

Logdate ProjCode Hrs
2003-09-11 SBS 3
2003-09-11 asd 9
2003-09-11 asd 9
2003-09-12 dsa 6
2003-09-13 zxc 5
2003-09-13 cxz 2

When i add a new field using
Quey: Select *, (select Sum(Hrs) from Table a where a.Logdate = b.Logdate Group by Logdate)from Table b

Result:
Logdate ProjCode Hrs Sum
2003-09-11 SBS 3 22
2003-09-11 asd 9 22
2003-09-11 asd 9 22
2003-09-12 dsa 6 6
2003-09-13 zxc 5 7
2003-09-13 cxz 2 7

how do i edit my query statement where i can get

Result:
Logdate ProjCode Hrs Sum
2003-09-11 SBS 3 22
2003-09-11 asd 9 null
2003-09-11 asd 9 null
2003-09-12 dsa 6 6
2003-09-13 zxc 5 7
2003-09-13 cxz 2 null

as only display 1 sum in 1 logdate where the rest is null.

Reply With Quote
  #2  
Old October 20th, 2003, 09:48 AM
m_lazor m_lazor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Luxembourg
Posts: 156 m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
to produce the last table in your problem description you have to create a temp table without the sum and then update the appropriate lines with the sum

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Some SQL problem in displaying data


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT