Solved

embedded SELECT in query

Posted on 2006-11-21
13
1,175 Views
Last Modified: 2008-01-09
Does anyone know the correct syntax for this:

SELECT  [Col a] AS [a], [Col b],
            name, SELECT SUM(amountTime) FROM myUps AS Expr1 .......


I have tried putting square brackets around the SELECT SUM(...  but that did not work either.
0
Comment
Question by:ARACK04
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
  • 2
13 Comments
 
LVL 33

Accepted Solution

by:
hongjun earned 250 total points
ID: 17987637
try this?

SELECT  [Col a] AS [a], [Col b], name, (SELECT SUM(amountTime) FROM myUps) AS Expr1 ...
0
 
LVL 65

Assisted Solution

by:rockiroads
rockiroads earned 250 total points
ID: 17987638
use round brackets

select [col a] as a, [col b], [name], (select sum(amountime) from myups ....)

0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17987640
or u can just use DSUM

select [col a] as a, [col b], [name], DSUM("amounttime","myups","where clause")

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 33

Expert Comment

by:hongjun
ID: 17987663
mine not working?
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17987681
thanks for the pts/grade :-D
I noticed hongjun posted the same but just beat me, if my 1st post worked, did his work? if so, a share of the spoils one thinks :)
0
 
LVL 33

Expert Comment

by:hongjun
ID: 17987806
A split would be more appropriate.
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17987964
hongjun, my sql is very similar to yours, the only visible difference that I can see is Name. I had wrapped it in square brackets because NAME itself is a reserved word in MS Access. Its not to say the SQL wont work without them, Im just saying that is a possibility.

0
 

Author Comment

by:ARACK04
ID: 17987984
I meant to split it, sorry - I selected the wrong two comments - my apologies.  Working with Acces is making me very stressed out,  oh how I miss the comfort of SQL Server
0
 

Author Comment

by:ARACK04
ID: 17988038
I'll re-post the quest - hongjun, you can answer it, and I'll award you the points.  Fair?
0
 
LVL 33

Expert Comment

by:hongjun
ID: 17988057
You should post a zero-point question in http://www.experts-exchange.com/Community_Support/ and state you decision to amend the split. A moderator / admin will reopen this question.

You should not be posting a new question.

hongjun
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17988071
I did wonder cos Im sure hongjun's code should work, I was just trying to guess why u may not of accepted it.
Now we know :)
I fully understand how stressful access can be, how I miss MySQL!!!
0
 
LVL 65

Expert Comment

by:rockiroads
ID: 17988125
ARACK04
there is a limit of max 500 pts per question
What u have to do is request from community support a reopen of this question so that u can allocate points accordingly.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question