Solved

embedded SELECT in query

Posted on 2006-11-21
13
1,174 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

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

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

710 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