Click here to Skip to main content
15,444,523 members
Home / Discussions / Database
   

Database

 
AnswerRe: Chinese antique furniture Pin
Christian Graus16-Oct-05 12:57
mveChristian Graus16-Oct-05 12:57 
QuestionApply UNIQUE using Visual Studio.Net Pin
Aayush Puri15-Oct-05 5:05
MemberAayush Puri15-Oct-05 5:05 
Questionchecking database Pin
abhinish15-Oct-05 1:11
Memberabhinish15-Oct-05 1:11 
AnswerRe: checking database Pin
Colin Angus Mackay15-Oct-05 2:07
MemberColin Angus Mackay15-Oct-05 2:07 
GeneralRe: checking database Pin
abhinish16-Oct-05 0:01
Memberabhinish16-Oct-05 0:01 
Questionado vc++ - datetime string or numbers to variant Pin
compoundeye14-Oct-05 20:55
Membercompoundeye14-Oct-05 20:55 
Questioncomplex query Pin
Joshua Lunsford14-Oct-05 12:02
MemberJoshua Lunsford14-Oct-05 12:02 
AnswerRe: complex query Pin
Colin Angus Mackay14-Oct-05 13:14
MemberColin Angus Mackay14-Oct-05 13:14 
Joshua Lunsford wrote:
the first 2 fields doesn't matter... primary keys. Third is a component code field, fourth field is a code tells me what the data in the 6th field means, 5th field is the is a sequence number... so in the sample VirusScan is '1' in the sequence of 'apl' applications and marimba is '2'...



You could join the table onto itself like this:

SELECT a.data, b.dataType, b.sequenceNumber, b.data
FROM #MyTable AS a
INNER JOIN #MyTable AS b ON a.pk1 = b.pk1 AND a.pk2 = b.pk2 AND a.sequenceNumber = b.sequenceNumber
WHERE a.dataType = 'NMP'
AND b.dataType <> 'NMP'


As you can see, I've aliased the table so that I can refer to it as "a" and "b" as if they were different tables.

I'm not sure of the importance of the 'APL' in the source data so I've ignored it. However, it may be important and would likely need referencing the join or where clause. The sample data you've given doesn't give any clues.

Also, the first two columns cannot make the primary key because they are all the same through the sample data - I suspect that the first 5 columns make the primary key.

Does this help?


My: Blog | Photos

"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucious


GeneralRe: complex query Pin
Joshua Lunsford17-Oct-05 11:49
MemberJoshua Lunsford17-Oct-05 11:49 
AnswerRe: complex query Pin
miah alom17-Oct-05 4:46
Membermiah alom17-Oct-05 4:46 
QuestionADO.NET Update / delete without primary keys Pin
Jasonc22114-Oct-05 11:10
MemberJasonc22114-Oct-05 11:10 
AnswerRe: ADO.NET Update / delete without primary keys Pin
miah alom17-Oct-05 5:52
Membermiah alom17-Oct-05 5:52 
GeneralRe: ADO.NET Update / delete without primary keys Pin
Jasonc22117-Oct-05 7:33
MemberJasonc22117-Oct-05 7:33 
GeneralRe: ADO.NET Update / delete without primary keys Pin
miah alom17-Oct-05 8:35
Membermiah alom17-Oct-05 8:35 
GeneralRe: ADO.NET Update / delete without primary keys Pin
Jasonc22118-Oct-05 9:22
MemberJasonc22118-Oct-05 9:22 
GeneralRe: ADO.NET Update / delete without primary keys Pin
l a u r e n21-Oct-05 15:04
Memberl a u r e n21-Oct-05 15:04 
AnswerRe: ADO.NET Update / delete without primary keys Pin
S Douglas20-Oct-05 1:45
professionalS Douglas20-Oct-05 1:45 
AnswerRe: ADO.NET Update / delete without primary keys Pin
l a u r e n21-Oct-05 15:06
Memberl a u r e n21-Oct-05 15:06 
GeneralRe: ADO.NET Update / delete without primary keys Pin
Jasonc22124-Oct-05 12:37
MemberJasonc22124-Oct-05 12:37 
QuestionSQL connection in servicedcomponents Pin
eliprand14-Oct-05 5:43
Membereliprand14-Oct-05 5:43 
AnswerRe: SQL connection in servicedcomponents Pin
eliprand14-Oct-05 6:08
Membereliprand14-Oct-05 6:08 
QuestionHow does Oracle support unicode text? Pin
Xiangyang Liu 刘向阳14-Oct-05 5:35
MemberXiangyang Liu 刘向阳14-Oct-05 5:35 
AnswerRe: How does Oracle support unicode text? Pin
DiWa14-Oct-05 19:30
MemberDiWa14-Oct-05 19:30 
GeneralRe: How does Oracle support unicode text? Pin
Xiangyang Liu 刘向阳14-Oct-05 19:50
MemberXiangyang Liu 刘向阳14-Oct-05 19:50 
QuestionConnection String Pin
kenexcelon13-Oct-05 14:27
Memberkenexcelon13-Oct-05 14:27 

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.