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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T15:45:05+00:00 2026-06-12T15:45:05+00:00

I have a range of products that do or do not include VAT. I

  • 0

I have a range of products that do or do not include VAT. I always want to show the price including VAT to the customer so I have a flag that states whether the price includes VAT or not. Currently I add VAT in PHP which means the sorting is something off as MySQL sorts on the base price and sometimes VAT can make the results out of order.

What I would like then is to automatically add VAT to prices, where it is needed, within the MySQL query. How can I achieve this?

My products table look like this:

product_id, product_dayprice, product_weekprice, product_includevat

product_includevat is simply a bool i.e. 1 or 0… VAT is stored as a PHP variable

My sort code looks like this which is designed to put products with a price of 0 at the end

CASE product_daypriceWHEN 0 then 40000 ELSE product_dayprice END
  • 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-12T15:45:06+00:00Added an answer on June 12, 2026 at 3:45 pm

    if that product_include_vat is a bool field, then it’d be as simple as

    SELECT product_weekprice + (product_weekprice * vat_rate * product_includevat)
    

    if the includevat field is false, it’ll evaluate to an integer 0, and your vat gets zeroed out in the multiplication.

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

Sidebar

Related Questions

I have range of numbers that range from 1 - 0.00000X . Most are
We have a range of Classic ASP applications that we are looking to port
I have a range of tables that I have normalized for a user profile
I have a range of data that I have approximated using a polynomial of
I have a Range variable that contains an address - $2:$2,$4:$205,$214:$214 - (3 groups
I have a set of products that must be scheduled. There are P products
I have a fairly complex SQL query that pulls different types of products from
I have created my jquery price slider but I am not sure how to
I have been asked to order products on a site to show any products
Suppose I have range from E2 to E16. How do I read values 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.