Click here to Skip to main content
15,892,059 members
Home / Discussions / Database
   

Database

 
AnswerRe: how to convert hex value???? Pin
Colin Angus Mackay10-Sep-07 23:45
Colin Angus Mackay10-Sep-07 23:45 
Questionhow to execute a function in linked server Pin
Sebastian T Xavier10-Sep-07 20:33
Sebastian T Xavier10-Sep-07 20:33 
AnswerRe: how to execute a function in linked server Pin
Marek Grzenkowicz12-Sep-07 1:16
Marek Grzenkowicz12-Sep-07 1:16 
QuestionHow do I do this in SQL Pin
Yitzchok Dev10-Sep-07 14:57
Yitzchok Dev10-Sep-07 14:57 
AnswerRe: How do I do this in SQL [modified] Pin
Chetan Patel10-Sep-07 19:43
Chetan Patel10-Sep-07 19:43 
QuestionHuh? Pin
Arjan Einbu10-Sep-07 22:15
Arjan Einbu10-Sep-07 22:15 
AnswerRe: Huh? Pin
John-ph10-Sep-07 23:15
John-ph10-Sep-07 23:15 
AnswerRe: How do I do this in SQL Pin
Arjan Einbu10-Sep-07 22:58
Arjan Einbu10-Sep-07 22:58 
You could create the inner query like this:
SELECT oi.CustomerID
FROM OrderItems oi
	JOIN Products p
WHERE p.ProductID IN ('Product1', 'Product2')
GROUP BY oi.CustomerID
HAVING COUNT(*) = 2

You'll have to dynamically create the WHERE p.ProductID IN (...) part, and the value for the HAVING COUNT(*) = 2 should use a parameter.

Joined with the customer table, the results could look something like this:
DECLARE @NumberOfProducts int
SET @NumberOfProducts = 2

SELECT
	c.*
FROM Customer c
	JOIN
	(
		SELECT oi.CustomerID
		FROM OrderItems oi
			JOIN Products p
		WHERE p.ProductID IN ('Product1', 'Product2')
		GROUP BY oi.CustomerID
		HAVING COUNT(*) = @NumberOfProducts
	) AS t
		ON t.CustomerID = c.CustomerID

GeneralRe: How do I do this in SQL Pin
Yitzchok Dev17-Sep-07 6:44
Yitzchok Dev17-Sep-07 6:44 
Questionanalysis service sql2005 Pin
ABBASI_RA9-Sep-07 20:14
ABBASI_RA9-Sep-07 20:14 
Questionconnecting the sql db in the server Pin
prasadbuddhika9-Sep-07 19:01
prasadbuddhika9-Sep-07 19:01 
AnswerRe: connecting the sql db in the server Pin
Blue_Boy9-Sep-07 21:02
Blue_Boy9-Sep-07 21:02 
AnswerRe: connecting the sql db in the server Pin
Rami Said Abd Alhalim9-Sep-07 23:34
Rami Said Abd Alhalim9-Sep-07 23:34 
AnswerRe: connecting the sql db in the server Pin
Frank Kerrigan10-Sep-07 9:24
Frank Kerrigan10-Sep-07 9:24 
Questiona mistake with the "Like" statement..help!.. Pin
keremburak9-Sep-07 8:23
professionalkeremburak9-Sep-07 8:23 
AnswerRe: a mistake with the "Like" statement..help!.. Pin
Blue_Boy9-Sep-07 8:33
Blue_Boy9-Sep-07 8:33 
AnswerRe: a mistake with the "Like" statement..help!.. Pin
Eddie Y Chen9-Sep-07 17:17
Eddie Y Chen9-Sep-07 17:17 
GeneralRe: a mistake with the "Like" statement..help!.. [modified] Pin
keremburak9-Sep-07 23:47
professionalkeremburak9-Sep-07 23:47 
GeneralRe: a mistake with the "Like" statement..help!.. Pin
Blue_Boy10-Sep-07 22:59
Blue_Boy10-Sep-07 22:59 
GeneralRe: a mistake with the "Like" statement..help!.. Pin
keremburak13-Sep-07 6:12
professionalkeremburak13-Sep-07 6:12 
GeneralRe: a mistake with the "Like" statement..help!.. Pin
Blue_Boy13-Sep-07 20:36
Blue_Boy13-Sep-07 20:36 
AnswerRe: a mistake with the "Like" statement..help!.. Pin
PIEBALDconsult10-Sep-07 5:08
mvePIEBALDconsult10-Sep-07 5:08 
GeneralRe: a mistake with the "Like" statement..help!.. Pin
Blue_Boy10-Sep-07 22:54
Blue_Boy10-Sep-07 22:54 
AnswerRe: a mistake with the "Like" statement..help!.. Pin
rohitsrivastava10-Sep-07 19:42
rohitsrivastava10-Sep-07 19:42 
GeneralRe: a mistake with the "Like" statement..help!.. Pin
Blue_Boy10-Sep-07 22:55
Blue_Boy10-Sep-07 22:55 

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.