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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:37:54+00:00 2026-06-04T04:37:54+00:00

I have a table in SQL Server that contains a column for a ledger

  • 0

I have a table in SQL Server that contains a column for a ledger code that is linked to the ledgercode table via keyfield. Currently the column displays the keyfield value instead of the code number I used this query to create a new table:

SELECT [OC_Key]
  ,[OC_PO_PO_DPNo]
  ,[OC_DateofInv]
  ,[V_VendorNo]
  ,[OC_ExpDescrip]
  ,[LedgerCode]
  ,[OC_InvoiceNo]
  ,[OC_DatePosted]
  ,[OC_TotAmount]
  ,[OC_Type]
  ,[OC_Initials]
INTO dbo.OCommittedTbl
FROM [CommittedTbl] CT, [codeLedgerTbl] LT, [VendorTbl] VT
WHERE VT.V_VenKey = CT.OC_VendorName and LT.LedgerKey = CT.OC_LedgerCode 

I problem I have is some of the rows in the table have a null value for the ledgercode column so this new table only pulls 34 of the 484 rows into the table.

How do I bypass the null values so that they will still be pulled into my table?

  • 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-04T04:37:55+00:00Added an answer on June 4, 2026 at 4:37 am

    Use a LEFT JOIN instead of an (implicit) INNER JOIN.

    SELECT ...
    INTO dbo.OCommittedTbl
    FROM [CommittedTbl] CT
    LEFT JOIN [codeLedgerTbl] LT ON LT.LedgerKey = CT.OC_LedgerCode 
    LEFT JOIN [VendorTbl] VT ON VT.V_VenKey = CT.OC_VendorName 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table which contains my ads that can be searched in sql-server-2008.
I have an SQL Server 2005 table that has a varchar(250) field which contains
I have a SQL Server table that contains postal addresses. In preparation for mailing,
I have a SQL Server 2008 database with a table that contains a FILESTREAM
I have a column in a SQL Server table that has the following rows:
I have a database column in a SQL Server 2008 database that contains VARCHAR
I have a table in a sql server 2008 database that contains bunch of
I have a table that contains a GEOMETRY data type. SQL Server 2008 ships
I have a table in SQL server that has the normal tree structure of
I have a History Table in SQL Server that basically tracks an item through

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.