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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:03:10+00:00 2026-05-16T22:03:10+00:00

I have the following SQL query SELECT tbl_product.prod_id, ISNULL (prod_code, ”) AS prod_code, ISNULL

  • 0

I have the following SQL query

SELECT tbl_product.prod_id,
       ISNULL (prod_code, '')                       AS prod_code,
       ISNULL (prod_category, '')                   AS prod_category,
       ISNULL(prod_title, '')                       AS prod_title,
       ISNULL(prod_price, 0.0)                      AS prod_price,
       ISNULL(tbl_product.prod_sales_price, 0.0)    AS prod_sales_price,
       ISNULL(prod_desc, '')                        AS prod_desc,
       ISNULL(prod_location, '')                    AS prod_location,
       brand_title,
       pd_discount = CASE
                       WHEN P_Discount > 0 THEN vw_discounts.P_Discount
                       WHEN B_discount > 0 THEN vw_discounts.B_discount
                       WHEN D_Discount > 0 THEN vw_discounts.D_Discount
                       ELSE 0.00
                     END,
       ISNULL((SELECT image_path
               FROM   tbl_image
               WHERE  tbl_image.prod_id = tbl_product.prod_id
                      AND image_primary = 1), '''') AS MainImage,
       ISNULL(prod_pick_from_store, 0)              AS prod_pick_from_store
FROM   tbl_product
       LEFT JOIN tbl_brand
         ON tbl_brand.brand_id = tbl_product.brand_id
       LEFT JOIN tbl_discount
         ON Pd_ProdId = tbl_product.Prod_id
       INNER JOIN vw_discounts
         ON Pd_ProdId = vw_discounts.prod_id
WHERE  tbl_product.prod_id > 270
       AND tbl_product.prod_id < 290  

At present this query does not return results for products which do not have an entry in tbl_discount. How can I adapt it so that it does?

  • 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-16T22:03:11+00:00Added an answer on May 16, 2026 at 10:03 pm

    I think what actually happens is that the records that do not have an entry in vw_discounts are ignored
    You should use a left join to join with the discounts view too

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

Sidebar

Ask A Question

Stats

  • Questions 543k
  • Answers 543k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer In the touchesBegan, touchesMoved, and touchesEnded methods, one parameter is… May 17, 2026 at 6:37 am
  • Editorial Team
    Editorial Team added an answer Line 2 I think your regular expression doesn't match with… May 17, 2026 at 6:37 am
  • Editorial Team
    Editorial Team added an answer Just set the Padding for the ListBoxItem to zero. That… May 17, 2026 at 6:37 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have the following SQL query: select expr1, operator, expr2, count(*) as c from
I have a following SQL QUERY: SELECT articles.name, articles.price, users.zipcode FROM articles INNER JOIN
I have the following SQL query: SELECT DISTINCT ProductNumber, PageNumber FROM table I am
I have the following SQL Query: SELECT porel.refcode, podetail.ponum, SUM(podetail.orderqty * podetail.unitcost) AS Total
I have the following SQL query: SELECT C.ID, C.Name FROM Category C JOIN Layout
Imagine I have the following SQL query: SELECT id,name FROM user WHERE id IN
I have the following sql query for transforming data but is it possible to
I am debugging some code and have encountered the following SQL query (simplified version):
I have the following Linq to SQL query, in which I'm trying to do
I have an SQL query that takes the following form: UPDATE foo SET flag=true

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.