Solved

embedded SELECT in query

Posted on 2006-11-21
13
1,168 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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

 
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

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…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

773 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