Click here to Skip to main content
15,905,614 members
Home / Discussions / Database
   

Database

 
AnswerRe: Query Question Pin
Wendelius25-Dec-08 7:06
mentorWendelius25-Dec-08 7:06 
QuestionRe: Query Question Pin
gnjunge25-Dec-08 20:57
gnjunge25-Dec-08 20:57 
AnswerRe: Query Question Pin
Wendelius25-Dec-08 21:59
mentorWendelius25-Dec-08 21:59 
GeneralRe: Query Question Pin
gnjunge26-Dec-08 2:00
gnjunge26-Dec-08 2:00 
GeneralRe: Query Question Pin
Wendelius26-Dec-08 4:57
mentorWendelius26-Dec-08 4:57 
GeneralRe: Query Question Pin
gnjunge26-Dec-08 21:48
gnjunge26-Dec-08 21:48 
GeneralRe: Query Question Pin
Wendelius26-Dec-08 22:14
mentorWendelius26-Dec-08 22:14 
GeneralRe: Query Question Pin
gnjunge26-Dec-08 22:59
gnjunge26-Dec-08 22:59 
I didn't mean the sum of the part ID's , but the number of parts (that were returned in the query) per car.

so if we have the following
carid   partid
1       2
1       3
1       4
2       2
2       5
3       2
3       3
3       4
3       5


and i would be looking for cars with parts 2, 3, and 4. I would first select all the cars that have at least one of the 3 parts, so cars 1, 2 and 3:
carid   partid
1       2
1       3
1       4
2       2
3       2
3       3
3       4

Note that car 2 has now only one record, and car 3 only has 3.

Then I count how many records per car:
carid   count parts
1       3
2       1
3       3

I know I was looking for 3 parts, so I select carid 1 and 3.

I guess these steps can go into one query.
GeneralRe: Query Question Pin
Wendelius27-Dec-08 2:49
mentorWendelius27-Dec-08 2:49 
GeneralRe: Query Question Pin
gnjunge27-Dec-08 5:23
gnjunge27-Dec-08 5:23 
GeneralRe: Query Question Pin
Wendelius27-Dec-08 5:54
mentorWendelius27-Dec-08 5:54 
GeneralRe: Query Question Pin
gnjunge27-Dec-08 20:36
gnjunge27-Dec-08 20:36 
GeneralRe: Query Question Pin
Wendelius27-Dec-08 21:56
mentorWendelius27-Dec-08 21:56 
GeneralRe: Query Question Pin
gnjunge27-Dec-08 21:59
gnjunge27-Dec-08 21:59 
GeneralRe: Query Question Pin
Wendelius27-Dec-08 22:15
mentorWendelius27-Dec-08 22:15 
GeneralRe: Query Question Pin
Jon_Boy30-Dec-08 14:26
Jon_Boy30-Dec-08 14:26 
GeneralRe: Query Question Pin
Wendelius30-Dec-08 19:34
mentorWendelius30-Dec-08 19:34 
QuestionQuery Help Pin
Saiyed Alam24-Dec-08 21:13
Saiyed Alam24-Dec-08 21:13 
AnswerRe: Query Help Pin
Wendelius25-Dec-08 7:13
mentorWendelius25-Dec-08 7:13 
QuestionSplit function Pin
cbe_pav24-Dec-08 1:43
cbe_pav24-Dec-08 1:43 
AnswerRe: Split function Pin
Paddy Boyd24-Dec-08 1:53
Paddy Boyd24-Dec-08 1:53 
AnswerRe: Split function Pin
cbe_pav24-Dec-08 17:41
cbe_pav24-Dec-08 17:41 
AnswerRe: Split function Pin
Niladri_Biswas1-Jul-09 18:33
Niladri_Biswas1-Jul-09 18:33 
QuestionSql server 2005 Pin
Nath23-Dec-08 22:59
Nath23-Dec-08 22:59 
AnswerRe: Sql server 2005 Pin
Krish - KP24-Dec-08 0:08
Krish - KP24-Dec-08 0:08 

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.