Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
T-SQL
»
Using the IN operator with two variable
Using the IN operator with two variable
Rate Topic
Display Mode
Topic Options
Author
Message
mozturk 92000
mozturk 92000
Posted Tuesday, December 18, 2012 1:51 PM
Forum Newbie
Group: General Forum Members
Last Login: Monday, January 07, 2013 8:05 AM
Points: 2,
Visits: 3
I would like to explain my problem with a simple example.
Here is a part of my database:
Type Service
----- -----
Freshwater Habitat
Saltwater Food
Dunes Recreation
That's the query I have: (It's HQL which is similar to T-SQL)
from Gecoserv _a where _a.typeOfEcosystem IN (:typeNameList) AND _a.service IN (:serviceNameList)
I want the grid to show only the single combinations (Freshwater-Habitat, Saltwater-Food and Dunes-Recreation etc.) but it shows also other combinations (ex: Freshwater-Recreation).
How can I fix my problem ?
Post #1398031
Sean Lange
Sean Lange
Posted Tuesday, December 18, 2012 1:57 PM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:33 PM
Points: 8,620,
Visits: 8,261
Hi and welcome to SSC. It is pretty difficult to provide a detailed answer for your question without speculating quite a few things. You might want to take a quick look at the first link in my signature for best practices when posting questions.
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1398037
Jeff Moden
Jeff Moden
Posted Tuesday, December 18, 2012 11:10 PM
SSC-Dedicated
Group: General Forum Members
Last Login: Today @ 3:14 PM
Points: 32,906,
Visits: 26,794
mozturk 92000 (12/18/2012)
(It's HQL which is similar to T-SQL)
How can I fix my problem ?
Write it as a stored procedure in T-SQL instead of relying on HQL.
--Jeff Moden
"
RBAR
is pronounced "ree-bar" and is a "Modenism" for "
R
ow-
B
y-
A
gonizing-
R
ow".
First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."
For better, quicker answers on T-SQL questions, click on the following...
http://www.sqlservercentral.com/articles/Best+Practices/61537/
For better answers on performance questions, click on the following...
http://www.sqlservercentral.com/articles/SQLServerCentral/66909/
Post #1398177
mozturk 92000
mozturk 92000
Posted Thursday, December 20, 2012 8:42 AM
Forum Newbie
Group: General Forum Members
Last Login: Monday, January 07, 2013 8:05 AM
Points: 2,
Visits: 3
T-SQL :
Select * from Gecoserv where typeOfEcosystem IN (:typeNameList) AND service IN (:serviceNameList)
Post #1399020
Sean Lange
Sean Lange
Posted Friday, December 21, 2012 7:45 AM
SSCrazy Eights
Group: General Forum Members
Last Login: Today @ 2:33 PM
Points: 8,620,
Visits: 8,261
mozturk 92000 (12/20/2012)
T-SQL :
Select * from Gecoserv where typeOfEcosystem IN (:typeNameList) AND service IN (:serviceNameList)
That is the same thing you posted originally. It seems you want some help with the code. I am willing to help but you have to provide me with something to work with. ddl, sample data and desired output. As I said before you find details about best practices for posting questions by clicking the first link in my signature. I am certain that if you post the necessary information you will have an answer very quickly.
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1399417
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.