Click here to Skip to main content
15,897,226 members
Home / Discussions / Database
   

Database

 
GeneralRe: Help with SQL in MS Access Pin
xx77abs7-Jun-09 3:42
xx77abs7-Jun-09 3:42 
Questionsp_helpsubscriberinfo returns empty table on MS SQL 2008 Pin
Roland Bär4-Jun-09 23:43
Roland Bär4-Jun-09 23:43 
QuestionIs something wrong in this? Pin
RajpootRohan4-Jun-09 23:20
professionalRajpootRohan4-Jun-09 23:20 
AnswerRe: Is something wrong in this? Pin
J4amieC5-Jun-09 0:22
J4amieC5-Jun-09 0:22 
AnswerRe: Is something wrong in this? Pin
Rob Philpott5-Jun-09 2:02
Rob Philpott5-Jun-09 2:02 
GeneralRe: Is something wrong in this? Pin
J4amieC5-Jun-09 2:55
J4amieC5-Jun-09 2:55 
GeneralRe: Is something wrong in this? Pin
musefan8-Jun-09 2:36
musefan8-Jun-09 2:36 
QuestionHow to encrypt SQL Server 2005 Database? Pin
A k ch4-Jun-09 21:49
A k ch4-Jun-09 21:49 
AnswerRe: How to encrypt SQL Server 2005 Database? Pin
Mycroft Holmes6-Jun-09 4:27
professionalMycroft Holmes6-Jun-09 4:27 
Questionquery not working correctly Pin
Mathew P V4-Jun-09 20:49
Mathew P V4-Jun-09 20:49 
AnswerRe: query not working correctly Pin
smcnulty20004-Jun-09 23:54
smcnulty20004-Jun-09 23:54 
GeneralRe: query not working correctly Pin
Mathew P V5-Jun-09 0:26
Mathew P V5-Jun-09 0:26 
GeneralRe: query not working correctly Pin
Niladri_Biswas6-Jun-09 19:01
Niladri_Biswas6-Jun-09 19:01 
QuestionMSOLAP.2 provider problem Pin
ThaScorpion4-Jun-09 3:26
ThaScorpion4-Jun-09 3:26 
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 

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.