Results 1 to 2 of 2
  1. #1
    kfc is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Oct 2012
    Posts
    3

    manipulating a queries

    how can i retrieve the first 10 rows of the firstnames (which is `prepodFamIO` ) found in the prepod table and the sum of the hours in a semester which is greatest the hours are found in plany table(which is `PAuditTime` ,given that the two information are in different tables.


    i know if i want to select the first 10 rows of the first names i can run this query


    Code:
        select * from prepod 
        limit 30;
    
    
    or
    
    
    
    
        select * from prepod 
        where rownum <= 30;
    and if i want to select the sum of hours which is greatest
    Code:
        SELECT MAX(PAuditTime)
         AS LargestNumber
         FROM plany
         order by PAuditTime;
    but how can i put them in one query ....i am using sql in access and ms sql thanks
    this is a snapshot of my database but im only interested in tables plany and prepod which is on the right coner of the image
    Click image for larger version. 

Name:	Untitled.png 
Views:	5 
Size:	34.2 KB 
ID:	9594

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    For the first query, the MS Access is SELECT TOP 10 * from PrePod.
    However, unless you use an order by clause, you have no way of knowing which 10 records you will get.

    I don't see what you want in the second query; the example you gave will return only one record - the one with the largest value of PAuditTime. It does not sum anything. Please explain what you want to do.

    John

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Need some help manipulating database columns
    By flightsimguy in forum Queries
    Replies: 7
    Last Post: 02-17-2012, 02:22 AM
  2. Manipulating text string
    By genemd in forum Queries
    Replies: 4
    Last Post: 10-21-2011, 05:04 AM
  3. Replies: 2
    Last Post: 06-01-2011, 08:36 AM
  4. Manipulating Form&Query Sources
    By dinorbaccess in forum Forms
    Replies: 3
    Last Post: 12-30-2010, 11:11 AM
  5. Manipulating datas on access table
    By 3rdeye in forum Access
    Replies: 6
    Last Post: 10-12-2010, 02:47 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums