home
training courses
why choose us?
solutions
support
company
LearnItFirst User Forum
Welcome Guest
Search
|
New Posts
|
Members
|
Log In
|
Register
SQL Server Forum - LearnItFirst.com
»
Transact-SQL Programming
»
DML (SELECT, INSERT, UPDATE, DELETE) Questions
»
Multiple conditions in sql query
Multiple conditions in sql query
Options
Previous Topic
·
Next Topic
abrars
Posted:
Sunday, May 24, 2009 5:40:35 AM
Rank: Newbie
Joined: 5/24/2009
Posts: 1
Points: 3
Where do you live?: aus
I have a table DVD where i have columns
dvdid
title
summary
price
due
classification --- G , PG , M etc
Status -- > Available or Not Available
I have to write a query where user enter the title in the search (like % )
the result displayed should meet this following condition
a) Status -- should be avaliable only DVD with status Availabe should be displayed
b) The classification should be G or PG --> other classification types are restricted
the query I was trying was as below ..
Code:
SELECT [DVDID], [Title], [Released], [Summary], [Status],[Due] FROM [DVD] WHERE ([Title] LIKE '%' + ? + '%') and ([Status] = 'Available')')
Now I am struggling to include the another condition where classification
How can I validate that condition. I tried using multiple select condition but I am not acheive the task.
Please help me. I am using access database
Thanks in Advance
Reply With Quote
Back to top
Scott Whigham
Posted:
Sunday, May 24, 2009 8:59:38 AM
Rank: Super Mod
Joined: 3/20/2006
Posts: 476
Points: 1,053
Where do you live?: Dallas, TX
Seems as though I don't understand the question - b/c what you've asked is too easy:
Code:
SELECT [DVDID], [Title], [Released], [Summary], [Status],[Due] FROM [DVD] WHERE ([Title] LIKE '%' + ? + '%') and ([Status] = 'Available')') AND Classification='PG'
See? I don't think I understand what you're asking.
Back to top
Users browsing this topic
Guest
Forum Jump
SQL Server Database Administration
- General SQL Database Question & Answer
- Backup, Recovery and Disaster Recovery
- SQL Server Security
- Integration Services (SSIS) and DTS
Transact-SQL Programming
- DML (SELECT, INSERT, UPDATE, DELETE) Questions
- Stored Procedures, Triggers, & Functions
SQL Server Scripts, Code Samples and SSMS Custom Reports
- All SQL Server Versions
- SQL Server 2005/2008
- SQL Server Management Studio Custom Reports
Customer Service
- Video Requests
You
cannot
post new topics in this forum.
You
cannot
reply to topics in this forum.
You
cannot
delete your posts in this forum.
You
cannot
edit your posts in this forum.
You
cannot
create polls in this forum.
You
cannot
vote in polls in this forum.
SQL Server 2005 DBA Training Videos
SQL Server 2008 DBA Training Videos
Email this topic
RSS Feed
Watch this topic
Print this topic
Normal
Threaded