• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 331
  • Last Modified:

sql query

i am using volusion store www.volusion.com

i have created a category name 'available products'

i want to filter all whats available in stock, i am using the following code
StockStatus <= 100

it filters quantity available between 1 to 100
but when quantity becomes +0 or -1 still its showing in available products
can someone help to modify the code
0
ammadeyy2020
Asked:
ammadeyy2020
1 Solution
 
x-menIT super heroCommented:
StockStatus between 1 and 100

or

StockStatus >= 1 AND StockStatus <=100
0
 
ammadeyy2020Author Commented:
i am using StockStatus <= 100

when quantity becomes 0 or - i dont want that product to be in available
0
 
x-menIT super heroCommented:
SELECT ª FROM mytable WHERE (StockStatus >= 1 AND StockStatus <=100)
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
ammadeyy2020Author Commented:
i think some problem in query, its givin error message

An error has occurred. Please try your request again, or contact customer service for assistance. Thank you.

when i remove the query its ok
0
 
SharathData EngineerCommented:
The query by x-men should work fine. Are you working in SQL Server or MySQL? You can try with BETWEEN..AND also.

SELECT * FROM mytable WHERE StockStatus BETWEEN 1 AND 100
0
 
JokoLennonoCommented:
SELECT *
FROM products_joined
WHERE
StockStatus IS NOT NULL
AND StockStatus > 0
AND StockStatus <= 100

if you want it to pull only products that have something specific in the product code or product name, then you'd filter it even further with something like:

SELECT *
FROM products_joined
WHERE
StockStatus IS NOT NULL
AND StockStatus > 0
AND StockStatus <= 100
AND productcode LIKE '%ABC%'
AND productname LIKE '%SELL THIS NOW%'

This will pull all products that you have in stock with a stock status between 1 and 100, and the product code contains "ABC" and the product name contains "SELL THIS NOW".

Best of luck
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now