Click here to Skip to main content
15,887,746 members
Home / Discussions / Database
   

Database

 
Questionhow to handle no data found error in sql server Pin
lakshmichawala4-Jun-09 3:25
lakshmichawala4-Jun-09 3:25 
AnswerRe: how to handle no data found error in sql server Pin
Ashfield4-Jun-09 21:04
Ashfield4-Jun-09 21:04 
QuestionOne more query problem Pin
sujithkumarsl3-Jun-09 23:36
sujithkumarsl3-Jun-09 23:36 
AnswerRe: One more query problem Pin
Mycroft Holmes4-Jun-09 19:42
professionalMycroft Holmes4-Jun-09 19:42 
AnswerRe: One more query problem Pin
Niladri_Biswas6-Jun-09 19:38
Niladri_Biswas6-Jun-09 19:38 
QuestionQuery problem [modified] Pin
sujithkumarsl3-Jun-09 22:31
sujithkumarsl3-Jun-09 22:31 
AnswerRe: Query problem [modified] Pin
Niladri_Biswas6-Jun-09 20:01
Niladri_Biswas6-Jun-09 20:01 
GeneralRe: Query problem Pin
Niladri_Biswas6-Jun-09 20:44
Niladri_Biswas6-Jun-09 20:44 
Anyway

Assuming that

For case 1:

Input 100,200,300 

Output:

A  B

1  100
1  200
1  300


Solution

SELECT MIN(A), B
FROM tbl_test
WHERE B IN (100, 200, 300)
GROUP BY B;


For Case 2:
I/P: 100 , 200

O/P:

A  B
1  100
1  200
2  100
2  200


Solution is

SELECT A, B
FROM tbl_test
WHERE B IN (100, 200)
ORDER BY A, B;


hope this helps.

And vote me Smile | :)

And from next time please define the function mapping your input to output more specifically

Smile | :)

Niladri Biswas

QuestionDefault Collation Pin
hadad3-Jun-09 22:03
hadad3-Jun-09 22:03 
QuestionPerfomance on the Following Query Pin
Vimalsoft(Pty) Ltd3-Jun-09 20:54
professionalVimalsoft(Pty) Ltd3-Jun-09 20:54 
AnswerRe: Perfomance on the Following Query Pin
Ashfield3-Jun-09 21:04
Ashfield3-Jun-09 21:04 
GeneralRe: Perfomance on the Following Query Pin
Vimalsoft(Pty) Ltd3-Jun-09 21:34
professionalVimalsoft(Pty) Ltd3-Jun-09 21:34 
GeneralRe: Perfomance on the Following Query Pin
Ashfield4-Jun-09 1:31
Ashfield4-Jun-09 1:31 
GeneralRe: Perfomance on the Following Query Pin
smcnulty20004-Jun-09 1:58
smcnulty20004-Jun-09 1:58 
AnswerRe: Perfomance on the Following Query Pin
smcnulty20003-Jun-09 22:36
smcnulty20003-Jun-09 22:36 
GeneralRe: Perfomance on the Following Query Pin
Vimalsoft(Pty) Ltd4-Jun-09 0:00
professionalVimalsoft(Pty) Ltd4-Jun-09 0:00 
GeneralRe: Perfomance on the Following Query Pin
Ashfield4-Jun-09 1:24
Ashfield4-Jun-09 1:24 
GeneralRe: Perfomance on the Following Query Pin
smcnulty20004-Jun-09 1:37
smcnulty20004-Jun-09 1:37 
QuestionFind feature in report viewer not working in Reporting services Pin
catmom3-Jun-09 10:51
catmom3-Jun-09 10:51 
QuestionRestore Database Parallel in sqlserver 2005 Pin
s_rajakrishna3-Jun-09 2:45
s_rajakrishna3-Jun-09 2:45 
Questionsql view Pin
jainiraj2-Jun-09 21:34
jainiraj2-Jun-09 21:34 
AnswerRe: sql view Pin
smcnulty20003-Jun-09 15:34
smcnulty20003-Jun-09 15:34 
AnswerRe: sql view Pin
_Damian S_3-Jun-09 16:04
professional_Damian S_3-Jun-09 16:04 
AnswerRe: sql view Pin
A k ch4-Jun-09 22:09
A k ch4-Jun-09 22:09 
Questioncreate proc from assembly Pin
Abdul Rahman Hamidy2-Jun-09 21:22
Abdul Rahman Hamidy2-Jun-09 21:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.