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

  • Home
  • SEARCH
  • 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 7849987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T18:42:27+00:00 2026-06-02T18:42:27+00:00

This query is working fine if I use T3.CardCode = ‘AC0109’ in second query

  • 0

This query is working fine if I use T3.CardCode = ‘AC0109’ in second query for inward values but if I use outward query refrence as (T3.CardCode = owt.CardCode) or (T3.CardCode = t1.CardCode) then it rises error

The multi-part identifier “owt.cardcode” or “t1.cardcode” could not be bound
Plz help me to solve this problem

SELECT TOP (100) PERCENT 
       owt.CardCode, 
       owt.CardName, 
       owt.DocDate, 
       owt.owtsector,
       owt.owtzone, 
       owt.Dscription, 
       owt.owtrate, 
       owt.owtqty, 
       owt.amount,
       ISNULL(inw.inwqty,0) AS Expr1, 
       ISNULL(inw.inwamount, 0) AS Expr2
FROM (SELECT T1.DocDate, 
             T1.CardCode, 
             T1.CardName, 
             T2.ItemCode, 
             T2.Dscription, 
             T1.U_STTYPE, 
             T1.U_SECTOR AS owtsector, 
             T1.U_ZONE AS owtzone, 
             SUM(T2.LineTotal) AS amount, 
             SUM(T2.Quantity) AS owtqty, 
             T2.CodeBars, 
             T2.Price AS owtrate
      FROM dbo.OWTR AS T1 
          INNER JOIN dbo.WTR1 AS T2 ON T1.DocEntry = T2.DocEntry
      WHERE (T1.DocDate = CONVERT(DATETIME, '2012-03-16 00:00:00', 102)) 
        AND (T1.CardCode = N'ac0109') 
        AND (T1.U_STTYPE = N'OUTWARD') 
        AND (T1.U_SECTOR NOT LIKE 'wr%')
      GROUP BY T1.DocDate, 
               T1.CardCode, 
               T1.CardName, 
               T2.ItemCode,
               T2.Dscription, 
               T1.U_STTYPE,  
               T2.Price,
               T1.U_SECTOR, 
               T1.U_ZONE, T2.CodeBars) AS owt 
LEFT OUTER JOIN (SELECT T3.DocDate, 
                       T3.CardCode, 
                       T3.CardName, 
                       T3.U_STTYPE, 
                       T4.ItemCode, 
                       T4.Dscription, 
                       SUM(T4.Quantity) AS inwqty, 
                       SUM(T4.LineTotal) AS inwamount
                FROM dbo.OWTR AS T3 
                   INNER JOIN dbo.WTR1 AS T4 ON T3.DocEntry = T4.DocEntry
                WHERE (T3.DocDate = CONVERT(DATETIME, '2012-03-16 00:00:00', 102)) 
                  AND (T3.CardCode = ***owt.CardCode***) 
                  AND (T3.U_STTYPE = N' inward ') 
                  AND (T3.U_SECTOR NOT LIKE ' wr % ')
                GROUP BY T3.DocDate, 
                         T3.CardCode, 
                         T3.CardName, 
                         T4.ItemCode, 
                         T4.Dscription, 
                         T3.U_STTYPE) AS inw 
  ON owt.CardCode = inw.CardCode 
 AND owt.DocDate = inw.DocDate
 AND owt.ItemCode = inw.ItemCode
  • 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-02T18:42:29+00:00Added an answer on June 2, 2026 at 6:42 pm

    The error is within your second subquery (inw) on this line:

    AND     (T3.CardCode = owt.CardCode) 
    

    I think it should be:

    AND     (T3.CardCode = T4.CardCode) 
    

    EDIT

    On further thought I don’t think you need this predicate at all since it is already contained in the join conditions.

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

Sidebar

Related Questions

I have this mysql query using PHP and first part is working fine, but
I have this query working but it is not returning back exactly what I
I have this query, which was working fine. SELECT SUM(amount) FROM company.invoice_line WHERE item_id
I have a Linq query which is working fine but i have noticed when
I need your help to translate a query into pyes. This query is working
Why this query doesn’t working: SELECT name FROM ( SELECT name FROM table1 UNION
why this simple query not working. I know it was OK before I upgraded
I have this working query: $q = $this->db->query('SELECT u.name FROM users u JOIN user_group
I am tired to find out why this simple query not working. SELECT image_url
In a SQL Server 2005 database I'm working on this query: select * from

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.