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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T01:29:48+00:00 2026-05-13T01:29:48+00:00

For some reason I cannot get my results set to restrict products that only

  • 0

For some reason I cannot get my results set to restrict products that only have the price status of “normal’. When I use a where clause like where pricestatus like 'normal' the results set also filters other records. Any ideas here?

SELECT   
   od.order_id, 
   ISNULL(p.pricestatus,'normal') as pricestatus,
   ISNULL(od.partnumber,'unknown') as partnumber,
   od.product_id, 
   od.producttitle, 
   qty, 
   od.price, 
   extprice, 
   customfield1 AS prodstatus, 
   ISNULL(categorytitle,'-') AS categorytitle, 
   needbydate, 
   customfield2 AS vendor, 
   (SELECT opttitle 
      FROM options o 
     WHERE Charindex(',' + Cast(o.opt_id AS VARCHAR) + ',',',' + opt_ids + ',') > 0 
           AND optlevel = 1) AS color, 
   (SELECT opttitle 
      FROM options o 
     WHERE Charindex(',' + Cast(o.opt_id AS VARCHAR) + ',',',' + opt_ids + ',') > 0 
           AND optlevel = 2) AS size, 
   od.producttitle + ISNULL((SELECT opttitle 
                               FROM options o 
                              WHERE Charindex(',' + Cast(o.opt_id AS VARCHAR) + ',',',' + opt_ids + ',') > 0 
                                AND optlevel = 1),'') + ISNULL((SELECT opttitle 
                                                                  FROM options o 
                                                                 WHERE  Charindex(',' + Cast(o.opt_id AS VARCHAR) + ',',',' + opt_ids + ',') > 0 
                                                                   AND optlevel = 2),'') + Cast(od.price AS VARCHAR(15)) AS pkey

FROM     
   orderdetails od 
  INNER JOIN orders ord ON ord.order_id = od.order_id 
  LEFT OUTER JOIN products p ON p.product_id = od.product_id 
  LEFT OUTER JOIN objectgroups ob ON p.objectgroup_id = ob.objectgroup_id 
  LEFT OUTER JOIN categories c ON ob.category_id = c.category_id 
WHERE  
    1=1 
    AND ord.shippingdate BETWEEN {ts '2009-10-05 00:01:00'} AND {ts '2009-10-21 23:59:59'} 
    AND ISNULL(ord.status,0) IN (5,12) 
    AND ISNULL(ord.status,0) <> 6 
    AND ISNULL(ord.status,0) <> 10 
    AND ISNULL(ord.status,0) <> 7 
    AND ISNULL(ord.status,0) <> 8 
ORDER BY 
    pkey
  • 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-13T01:29:49+00:00Added an answer on May 13, 2026 at 1:29 am

    You are doing a LEFT OUTER JOIN on Products. Remeber that if you put a condition in the WHERE clause it’s going to apply that condition to the WHOLE set, so any row that doesn’t bring back a product will automatically get filtered out because your condition can’t be true.

    You will need to add the condition to your join instead:

    LEFT OUTER JOIN products p 
       ON p.product_id = od.product_id AND p.priceStatus LIKE "%normal%'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

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.