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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T10:14:49+00:00 2026-05-24T10:14:49+00:00

I’m no SQL guru, by any means, and I’m having a hard time wrapping

  • 0

I’m no SQL guru, by any means, and I’m having a hard time wrapping my head around how to do a certain SQL query.

I have three Oracle database tables, MBRHISTDETL, LOCINFODETL, and METERCHGDETL. From MBRHISTDETL I’ll get the following fields: MBRSEP, LOCATION, BILLTYPE, BILLMOYR, KWH. From LOCINFODETL (LOCATION is key) I’ll get DIST, CYCLE, ADDR1. From METERCHGDETL (MBRSEP is key) I’ll get METER.

So far, using my query below, I’m able to get all the information I need from MBRHISTDETL and LOCINFODETL. However, I don’t quite now how to add the next table, METERCHRDETL, into the query statement. Can someone help me out with this?

Here’s my query, so far:

SELECT LOCINFODETL.LOCATION AS L.LOCATION, 
    LOCINFODETL.DIST, LOCINFODETL.CYCLE,
    LOCINFODETL.ADDR1, MBRHISTDETL.MBRSEP, 
    MBRHISTDETL.LOCATION AS M.LOCATION, 
    MBRHISTDETL.BILLTYPE, MBRHISTDETL.BILLMOYR, 
    MBRHISTDETL.KWH
FROM MBRHISTDETL 
    INNER JOIN L.LOCINFODETL ON H.MBRHISTDETL.LOCATION = L.LOCATION
WHERE MBRHISTDETL.BILLTYPE = '09' 
  AND CAV_MBRHISTDETL.BILLMOYR <> '9999' 
  AND SUBSTR(LOCINFODETL.CYCLE,0,2) = '04' 
  AND LOCINFODETL.DIST = '16' 
  • 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-24T10:14:49+00:00Added an answer on May 24, 2026 at 10:14 am

    This should get you started — but you need to know which field links your M table.

    Also — just a style tip — if you’re trying to make sense out of sql for the first time especially — you’ll be able to proof your sql a lot easier if you format it a little more vertcially. My style might not be the best, but you can see if it makes things easier to read for you anyway.

    SELECT
       L.LOCATION AS L_LOCATION, 
       L.DIST, 
       L.CYCLE,
       L.ADDR1, 
       H.MBRSEP, 
       H.LOCATION AS H_LOCATION, 
       H.BILLTYPE, 
       H.BILLMOYR, 
       H.KWH,
       M.METER
    FROM 
          MBRHISTDETL H
       INNER JOIN 
          LOCINFODETL L 
       ON 
          H.LOCATION = L.LOCATION
       INNER JOIN
          METERCHRDETL M
       ON M.___KEY___ = H.___KEY___ -- or perhaps L.___KEY___
    WHERE 
           H.BILLTYPE = '09' 
       AND H.BILLMOYR <> '9999' 
       AND SUBSTR(L.CYCLE,0,2) = '04' 
       AND L.DIST = '16' 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.