Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Really need somebody's help! (urgent!)

Author  Topic 

klondikegurl
Starting Member

5 Posts

Posted - 2011-07-17 : 05:06:29
NAME DATE PRESENTS
bob march 3 2011 1
bob june 6 2008 2
bob jan 3 2012 3
mary feb 14 1986 4
mary april 10 2001 5
mary jan 3 2012 6
kate march 3 2011 7
kate jan 3 2012 8
kate oct 9 2013 9
celia march 3 2011 10
celia feb 14 1986 11
celia july 4 2011 12
celia jan 3 2012 13
celia feb 14 1991 14


So the goal is we add the amount of presents kate and celia got on the same days if they got any on the same days

What I need to do is kind of like this except with a much bigger data set. Prolly in the 100 000 entries.
i need the answer in SQL code   or access 2003 query SQL.

Thanks!

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2011-07-17 : 06:55:49
Looks like a reasonably simple sum with group by. What have you done so far?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2011-07-17 : 11:49:42
I'm curious - what is the nature of the urgency? Are you in the process of taking a test or in a job interview or something?

Be One with the Optimizer
TG
Go to Top of Page

klondikegurl
Starting Member

5 Posts

Posted - 2011-07-19 : 05:18:24
to GilaMonster and TG. I'm a student on a summer job and my job has a lot of programming aspects and data management. Its also my first time dealing with ms access and excel languages so I've been googling and consulting forums. This is an example I made up that is related to something I need for work. and i have learnt to do macros in excel but sql in access is giving me a real tough time. I was asked to do a query to have access do this for me. but i dont think i can set all the criteria right for one query so i was thinking i might need subqueries and eventually resulted to using sql with which i have no experience.

If you can explain more in depth of this simple sum and group by or an example code that would be great. anythign would be great rly! ive been googling for two days getting no where >.> Thank you!
Go to Top of Page

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2011-07-19 : 06:40:38
quote:
"Really need somebody's help! (urgent!)"

Nope. You don't.
Your database is still intact. The server is not on fire.

It is a simple question. People don't respond well to urgent posts that are not urgent.

The query would look something like:

SELECT
[NAME] AS [Name]
, [DATE] AS [Date]
, SUM([PRESENTS]) AS [Total Presents]
FROM
<<theTable>>
GROUP BY
[NAME]
, [DATE]

Also -- [DATE] are really bad names for columns. 1)DATE is a keyword. 2) Which / What date does it represent.



Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page
   

- Advertisement -