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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:54:56+00:00 2026-05-27T14:54:56+00:00

In my query I need to return distinct fields for my search. However the

  • 0

In my query I need to return distinct fields for my search. However the txt_note field returns info even if there is none.

SELECT DISTINCT T_ORDER_DETAIL.TXT_ORDER_NUMBER, 
                T_ORDER_DETAIL.CUSTOMER_PRODUCT_ID, 
                T_VENDOR.VENDOR_ID, 
                T_CUSTOMER_ACCOUNT.CUSTOMER_ID, 
                T_EMPLOYEE.TXT_EMAIL, 
                T_ORDER_ASSIGNMENT.TXT_NOTE 
FROM   T_VENDOR_EMPLOYEE 
       INNER JOIN T_VENDOR WITH(nolock) 
               ON T_VENDOR_EMPLOYEE.VENDOR_ID = T_VENDOR.VENDOR_ID 
       INNER JOIN T_CUSTOMER_ACCOUNT WITH(nolock) 
                  INNER JOIN T_ORDER_DETAIL WITH(nolock) 
                             INNER JOIN T_CUSTOMER_PRODUCT WITH(nolock) 
                                     ON T_ORDER_DETAIL.CUSTOMER_PRODUCT_ID = 
                                        T_CUSTOMER_PRODUCT.CUSTOMER_PRODUCT_ID 
                          ON T_CUSTOMER_ACCOUNT.CUSTOMER_ACCOUNT_ID = 
                             T_CUSTOMER_PRODUCT.CUSTOMER_ACCOUNT_ID 
               ON T_VENDOR_EMPLOYEE.VENDOR_EMPLOYEE_ID = 
                  T_ORDER_DETAIL.VENDOR_EMPLOYEE_ID 
       INNER JOIN T_EMPLOYEE WITH(nolock) 
               ON T_VENDOR_EMPLOYEE.EMPLOYEE_ID = T_EMPLOYEE.EMPLOYEE_ID 
       INNER JOIN T_ORDER_DETAIL_REJECTION_REASON WITH(nolock) 
               ON T_ORDER_DETAIL.ORDER_DETAIL_ID = 
                  T_ORDER_DETAIL_REJECTION_REASON.ORDER_DETAIL_ID 
       INNER JOIN T_ORDER_ASSIGNMENT WITH(nolock) 
               ON T_VENDOR_EMPLOYEE.VENDOR_EMPLOYEE_ID = 
                  T_ORDER_ASSIGNMENT.VENDOR_EMPLOYEE_ID 
WHERE  T_ORDER_ASSIGNMENT.INT_ACCEPTED = 4 
       AND T_ORDER_ASSIGNMENT.TXT_NOTE <> '' 

Even though it returns info, when you look at the actual order that field is blank.

txt_Order_Number    Customer_Product_ID vendor_ID   customer_id txt_email   txt_Note
260247648   555 134242  650 jason@propertysmart.us  Out of office
260498186   2783    134242  429 jason@propertysmart.us  Out of office
261108453b  1485    134242  206 jason@propertysmart.us  Out of office
261240252b  4429    134242  206 jason@propertysmart.us  Out of office
270158583b  4429    134242  206 jason@propertysmart.us  Out of office
270877727   3190    134242  724 jason@propertysmart.us  Out of office
271239690b  4817    134242  486 jason@propertysmart.us  Out of office
280162866b  5378    134242  721 jason@propertysmart.us  Out of office
280968017b  1485    134242  206 jason@propertysmart.us  Out of office
290702640   9361    134242  120 jason@propertysmart.us  Out of office
291294922-50    9972    134242  977 jason@propertysmart.us  Out of office
300453305-25    3648    134242  206 jason@propertysmart.us  Out of office
301297011-50    1922    134242  206 jason@propertysmart.us  Out of office

only one of the txt_not actually has out of office in it and the rest are blank.

any help is greatly appreciated.

Thanks

  • 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-27T14:54:57+00:00Added an answer on May 27, 2026 at 2:54 pm

    I would try simplifying the query, starting with as few inner joins as possible. Ie:

    SELECT * 
    FROM t_Vendor_Employee 
    INNER JOIN t_Order_Assignment ON t_Vendor_Employee.vendor_employee_id = t_Order_Assignment.vendor_employee_id 
    WHERE t_Order_Assignment.int_Accepted = 4 and t_Order_Assignment.txt_Note <> '' 
    

    If this gives the expected result, add more inner joins until you get your error – then look at the data and see if you can identify the cause.


    Also, are you aware that your use of WITH (NOLOCK) might cause you to miss committed rows?

    http://blogs.msdn.com/sqlcat/archive/2007/02/01/previously-committed-rows-might-be-missed-if-nolock-hint-is-used.aspx

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

Sidebar

Related Questions

how set distinct to this query return _dataContext.ProjectPictures.Include(Projects).Include(ProjectPictureTypes).Where(p => p.ProjectPictureTypes.Id == 1).ToList(); i need
Suppose a query select * from employee returns 80 rows. I need to display
I currently have a SQL query that returns a number of fields. I need
I need help with a query to get distinct records from the table. SELECT
I need a query that will return a table where each column is the
Why the two query below return duplicate member_id and not the third? I need
I need a SQL query that returns ContactDate, SortName, City, ContactType, and Summary from
I need to write a query that returns all object less that or equal
Basically, the question says it all. I need a PL\SQL query that returns a
I have a table that has multiple fields which I just need one field.

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.