Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6837295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:27:37+00:00 2026-05-26T23:27:37+00:00

Here is my current query: SELECT sac.cred, s.status, (SELECT NVL (csl.census_dates, tl.census_dates) FROM schema.sections

  • 0

Here is my current query:

SELECT sac.cred, s.status, (SELECT NVL (csl.census_dates, tl.census_dates) 
                                         FROM  schema.sections cs,  schema.sections_ls csl,  schema.terms tl 
                                        WHERE cs.course_sections_id = csl.course_sections_id(+)AND csl.pos(+) = 1 AND cs.term = tl.terms_id 
                                          AND tl.pos = 1 AND cs.course_sections_id = cs2.course_sections_id AND ROWNUM = 1)AS censusDate, 
                                      (SELECT NVL (p.ssn, 'xxx-xx-xxxx') FROM   schema.person p 
                                        WHERE p.id = sac.person_id) AS ssn, 
                                       //schema.person_name(sac.person_id, 'FML') as fml, 
                                       //schema.person_name(sac.person_id, 'LF') as lf 
                                 FROM  schema.student_acad_cred sac JOIN  schema.statuses s 
                                   ON s.student_acad_cred_id = sac.student_acad_cred_id 
                                 JOIN  schema.terms tl ON sac.term = tl.terms_id 
                                 JOIN  schema.student_course_sec scs ON sac.student_course_sec = scs.student_course_sec_id 
                                 JOIN  schema.course_sections cs2 ON scs.course_section = cs2.course_sections_id 
                                 JOIN  schema.terms t ON tl.terms_id = t.terms_id 
                                WHERE sac.person_id = '1111111111' 
                                  AND (s.status IN ('A', 'N') OR (s.status = 'D' AND final_grade IS NOT NULL)) 
                                  AND s.pos = '1'AND tl.pos = '1' AND tl.terms_id = 'spring'; 

And here are the results:

cred      status   currentDate   censusDate     ssn
====      ======   ===========   ==========     ===
  3         N       11/16/2011   12/15/2011      xxx-xx-xxxx
  4         N       11/16/2011   12/15/2011      xxx-xx-xxxx
  3         N       11/16/2011   12/15/2011      xxx-xx-xxxx
  4         N       11/16/2011   12/15/2011      xxx-xx-xxxx
  1         N       11/16/2011   12/15/2011      xxx-xx-xxxx

Okay, what I am trying to do is use sum() (or some other function) to add up all the credit hours that are pulled. So in this instance the sum of all cred hours would be ’15’. Is there a way to do this in query? Ideally I would want something like this:

cred      status   currentDate   censusDate     ssn
====      ======   ===========   ==========     ===
 15         N       11/16/2011   12/15/2011      xxx-xx-xxxx
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:27:38+00:00Added an answer on May 26, 2026 at 11:27 pm

    The way to do this is to GROUP BY all of your other columns. Since you can’t group by aliased columns directly (in Oracle and most RDMBSes), you have to wrap the whole thing in another query and do the grouping there.

    SELECT SUM(cred), status, censusDate, ssn 
    FROM
        (SELECT sac.cred, s.status, 
              (SELECT NVL (csl.census_dates, tl.census_dates) 
                 FROM  schema.sections cs,  schema.sections_ls csl,  schema.terms tl 
                WHERE cs.course_sections_id = csl.course_sections_id(+)AND csl.pos(+) = 1 AND cs.term = tl.terms_id 
                  AND tl.pos = 1 AND cs.course_sections_id = cs2.course_sections_id AND ROWNUM = 1)AS censusDate, 
              (SELECT NVL (p.ssn, 'xxx-xx-xxxx') FROM   schema.person p 
                WHERE p.id = sac.person_id) AS ssn, 
               //schema.person_name(sac.person_id, 'FML') as fml, 
               //schema.person_name(sac.person_id, 'LF') as lf 
         FROM  schema.student_acad_cred sac JOIN  schema.statuses s 
           ON s.student_acad_cred_id = sac.student_acad_cred_id 
         JOIN  schema.terms tl ON sac.term = tl.terms_id 
         JOIN  schema.student_course_sec scs ON sac.student_course_sec = scs.student_course_sec_id 
         JOIN  schema.course_sections cs2 ON scs.course_section = cs2.course_sections_id 
         JOIN  schema.terms t ON tl.terms_id = t.terms_id 
        WHERE sac.person_id = '1111111111' 
          AND (s.status IN ('A', 'N') OR (s.status = 'D' AND final_grade IS NOT NULL)) 
          AND s.pos = '1'AND tl.pos = '1' AND tl.terms_id = 'spring')
    GROUP BY status, censusDate, ssn;
    

    This looks ugly, but doesn’t actually have a horrible performance impact.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my current SQL statement: SEARCH_ALBUMS_SQL = SELECT * FROM albums WHERE title LIKE
My current query: SELECT Series.*, Episodes.* FROM Series, Episodes WHERE EpisodeAirDate > '.time().' AND
Here is my current sql query SELECT w.city, t.tmc, t.date, t.time, w.event, ROUND(AVG(w.Pave), 0)
Here's my current query: SELECT IFNULL(sum(open_for), 0) total, count(IF(open_for > 0, 1, null)) wins,
Here is the updated question: the current query is doing something like: $sql1 =
Here is my current setup: Database Role - MyDbRole Schema - MySchema User -
Cited from http://xss-proxy.sourceforge.net/Advanced_XSS_Control.txt : As many here probably know, current XSS attacks typically come
Ok, here we go... I have a select query accessing a very abstract database.
My current query:- select p.id as product_id, p.product_name, child.name as category_name, parent.name as parent_category_name
Here is my current question: I'm guessing that my problem (described below) is being

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.