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 8615673
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:26:14+00:00 2026-06-12T05:26:14+00:00

I have this query that I want to put into the ‘modern Join syntax’

  • 0

I have this query that I want to put into the ‘modern Join syntax’

SELECT  
    t.acct_order, 
    c1.acct_desc, 
    c1.position, 
    c1.end_pos,
    Budget = sum(((g.data_set-1)/2)*(g.debits - g.credits)),
    Actual = sum(((g.data_set-3)/-2)*(g.debits - g.credits)) 

FROM    
    glm_chart c1, 
    glm_chart c2, 
    glh_deptsum g, 
    #TEMPTABLE t

WHERE   
        g.acct_uno=c2.acct_uno  
    and c1.acct_code = t.acct_code  
    and c2.position between c1.position and c1.end_pos  
    and g.debits-g.credits<>0 
    and c1.book=1  
    and g.data_set in (1, 3)  
    and (g.period between 201201 and 201212) 

GROUP   by  t.acct_order, 
            c1.acct_desc, 
            c1.position,
            c1.end_pos 

ORDER   by  t.acct_order 

This is what I got to, but as you can see I can’t seem to identify the join to table glh_deptsum (g) to C1 or to T

SELECT  
    t.acct_order, 
    c1.acct_desc, 
    c1.position, 
    c1.end_pos,
    sum(((g.data_set-1)/2)*(g.debits - g.credits))  AS Budget,
    sum(((g.data_set-3)/-2)*(g.debits - g.credits)) AS Actual, 


FROM         #TEMPTABLE T
INNER JOIN  glm_chart c1 ON c1.acct_code = t.acct_code
INNER JOIN  glh_deptsum g <---- HELP WHAT GOES HERE ---------
INNER JOIN  glm_chart c2 ON c2.position between c1.position and c1.end_pos AND g.acct_uno=c2.acct_uno


WHERE   
    g.debits - g.credits <> 0 
    AND c1.book=1  
    AND g.data_set in (1, 3) 
    AND (g.period between 201201 and 201212) 

GROUP BY t.acct_order, 
            c1.acct_desc, c1.position,c1.end_pos 

ORDER BY t.acct_order 

Can anyone let me know what I’m doing wrong please?

  • 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-06-12T05:26:16+00:00Added an answer on June 12, 2026 at 5:26 am

    It looks like it should be this:

    SELECT t.acct_order, 
        c1.acct_desc, 
        c1.position, 
        c1.end_pos,
        Budget = sum(((g.data_set-1)/2)*(g.debits - g.credits)),
        Actual = sum(((g.data_set-3)/-2)*(g.debits - g.credits)) 
    FROM #TEMPTABLE t
    INNER JOIN glm_chart c1
      ON t.acct_code = c1.acct_code
    INNER JOIN glm_chart c2
      ON c2.position between c1.position and c1.end_pos  
    INNER JOIN glh_deptsum g
      ON c2.acct_uno = g.acct_uno
    WHERE g.debits-g.credits<>0 
        and c1.book=1  
        and g.data_set in (1, 3)  
        and (g.period between 201201 and 201212) 
    GROUP by  t.acct_order, 
                c1.acct_desc, 
                c1.position,
                c1.end_pos 
    ORDER   by  t.acct_order 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have have this query that i want to execute. SELECT warehouse.expiry_date, pharmacy.expiry_date, drugs.active_substance,
I have this query that inserts rows, using a subquery like so: INSERT INTO
So I have this query that works perfectly: SELECT users.*, GROUP_CONCAT(categories.category_name) AS categories FROM
I have this query: SELECT Stops_edited_small1.AtcoCode, ABC.Naptan_Atco, ABC.Stop_Code FROM Stops_edited_small1 INNER JOIN ABC ON
I have an SQL Query that i'm running but I only want to select
I'm using Python and I have some data that I want to put into
I have this query that returns the results by ordering it by focus.name ASC.
I have this query that, due to the number of records, is taking several
I have this SQL Query that pulls data from 3 tables. I am unable
I have this working query that outputs URL and click counts from database. <?php

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.