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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T23:31:54+00:00 2026-05-24T23:31:54+00:00

I’ve been having problems trying to retrieve data from my database to a DataTable

  • 0

I’ve been having problems trying to retrieve data from my database to a DataTable in Microsoft Visual C#. I’ve been told it’s because of improper use of INNER JOINs. The query (Fill method) is the one that follows.

SELECT Bordero.id AS id, Titulo.id AS id_titulo, Titulo.valor AS valor_titulo, 
       Sacado.nome AS nome_sacado, Cliente.nome AS nome_cliente, Sacado.documento,
       Titulo.taxa_adm AS taxa_adm_titulo, Titulo.desagio AS desagio_titulo, 
       Titulo.liquido AS liquido_titulo, 
       (CASE Titulo.tipo 
             WHEN 'True' THEN 'Cheque' 
             ELSE 'Duplicata' 
        END) AS tipo, Titulo.dias, Titulo.codigo, Titulo.vencimento, 
       Titulo.data_base, Bordero.desagio AS desagio_bordero, 
       Bordero.taxa_adm AS taxa_adm_bordero, Bordero.liquido AS liquido_bordero, 
       Bordero.bruto, Bordero.duplicata, Bordero.desconto, Bordero.iss, Bordero.iof,
       Bordero.cpmf, Bordero.pis, Bordero.cofins, Desconto.valor AS valor_desconto,
       Desconto.descricao, Bordero.id_cliente
FROM   Bordero 
INNER JOIN Cliente ON Bordero.id_cliente = Cliente.id
INNER JOIN Titulo ON Bordero.id = Titulo.bordero_id
INNER JOIN Sacado ON Sacado.id = Titulo.sacado_id
INNER JOIN Desconto ON Cliente.id = Desconto.id_cliente

The database diagram looks like this:
http://i53.tinypic.com/t0g4qp.jpg

Any hints on what’s wrong?

  • 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-24T23:31:55+00:00Added an answer on May 24, 2026 at 11:31 pm

    Without stating what your problem is that you’re experiencing my guess would be that you may need to be using LEFT OUTER JOIN for some of the tables instead of all INNER JOIN.

    When using an INNER JOIN in a query, the data that you’re matching via the ON clause must be not null in both tables. Meaning that if the ID exists on the left table (the one in the FROM clause) there must be a matching record in the right table (the one you’re joining in via the INNER JOIN). If the right table does not have a matching record, the entire result is dropped from the query.

    By using a LEFT OUTER JOIN instead, you allow the right table to return NULL instead for each data row that doesn’t match.

    TABLE A       TABLE B
    ID  |  Name   ID  | Address
    1   |  Alice  1   | 123 ABC St.
    2   |  Bob    3   | 789 XYZ St.  
    3   |  Cam
    

    Using the above tables, if you were to do an FROM A INNER JOIN B ON A.ID = B.ID only rows 1 and 3 would be returned. If you were to do a FROM A LEFT OUTER JOIN B ON A.ID = B.ID all rows from A would be returned and B.Address would be null for #2.

    • 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'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a jquery bug and I've been looking for hours now, I can't
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I am currently running into a problem where an element is coming back from
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have a bunch of posts stored in text files formatted in yaml/textile (from
We're building an app, our first using Rails 3, and we're having to build

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.