Solved

sql query

Posted on 2013-12-17
6
274 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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

Confronted with some SQL you don't know can be a daunting task. It can be even more daunting if that SQL carries some of the old secret codes used in the Ye Olde query syntax, such as: (+)     as used in Oracle;     *=     =*    as used in Sybase …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

708 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

17 Experts available now in Live!

Get 1:1 Help Now