Solved

sql query

Posted on 2013-12-17
6
282 Views
Last Modified: 2014-04-10
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
Comment
Question by:ammadeyy2020
6 Comments
 
LVL 18

Expert Comment

by:x-men
ID: 39724362
StockStatus between 1 and 100

or

StockStatus >= 1 AND StockStatus <=100
0
 

Author Comment

by:ammadeyy2020
ID: 39724380
i am using StockStatus <= 100

when quantity becomes 0 or - i dont want that product to be in available
0
 
LVL 18

Expert Comment

by:x-men
ID: 39724400
SELECT ª FROM mytable WHERE (StockStatus >= 1 AND StockStatus <=100)
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:ammadeyy2020
ID: 39724411
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
 
LVL 40

Expert Comment

by:Sharath
ID: 39725421
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
 
LVL 1

Accepted Solution

by:
JokoLennono earned 500 total points
ID: 39790182
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now