SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Really need somebody's help! (urgent!)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

klondikegurl
Starting Member

Canada
5 Posts

Posted - 07/17/2011 :  05:06:29  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

South Africa
4507 Posts

Posted - 07/17/2011 :  06:55:49  Show Profile  Visit GilaMonster's Homepage  Reply with Quote
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
Flowing Fount of Yak Knowledge

USA
6062 Posts

Posted - 07/17/2011 :  11:49:42  Show Profile  Reply with Quote
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

Canada
5 Posts

Posted - 07/19/2011 :  05:18:24  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

United Kingdom
3451 Posts

Posted - 07/19/2011 :  06:40:38  Show Profile  Visit Transact Charlie's Homepage  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000