Solved

embedded SELECT in query

Posted on 2006-11-21
13
1,165 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
  • 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now