Click here to Skip to main content
15,925,723 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to access window ? Pin
Eddy Vluggen17-Oct-12 9:32
professionalEddy Vluggen17-Oct-12 9:32 
GeneralRe: How to access window ? Pin
nghia09t317-Oct-12 12:47
nghia09t317-Oct-12 12:47 
AnswerRe: How to access window ? Pin
Richard Andrew x6417-Oct-12 14:06
professionalRichard Andrew x6417-Oct-12 14:06 
GeneralRe: How to access window ? Pin
nghia09t317-Oct-12 14:29
nghia09t317-Oct-12 14:29 
QuestionDatabase to C++ Pin
shiftwik16-Oct-12 16:21
shiftwik16-Oct-12 16:21 
AnswerRe: Database to C++ Pin
Jochen Arndt16-Oct-12 21:21
professionalJochen Arndt16-Oct-12 21:21 
Questionsubquery using 1 table Pin
john john mackey16-Oct-12 7:26
john john mackey16-Oct-12 7:26 
AnswerRe: subquery using 1 table Pin
fjdiewornncalwe16-Oct-12 8:01
professionalfjdiewornncalwe16-Oct-12 8:01 
Because you are using the same column and table in the subquery, then you simply make the subquery redundant.
SQL
SELECT SomeField, AccountName FROM AccountInfo WHERE AccountID=123456
will get you the accurate result.
The issue in your query is that you may have more than 1 record in the accountInfo table with a given CustomerID so you will throw an error in that the subquery can have multiple results when it can only have one. If you actually want more than one result then you could do something like this, but I'm not entirely sure the inner join will be valid like this. Something you can try, though.
SQL
SELECT t1.SomeField,
       t2.AccountName
  FROM tblAccountInfo t1
       INNER JOIN tblAcocuntInfo t2 ON t2.CustomerID = t1.CustomerID
 WHERE t1.AccountID = 123456

I wasn't, now I am, then I won't be anymore.

GeneralRe: subquery using 1 table Pin
john john mackey16-Oct-12 9:50
john john mackey16-Oct-12 9:50 
AnswerRe: subquery using 1 table Pin
Michael Potter16-Oct-12 10:38
Michael Potter16-Oct-12 10:38 
AnswerRe: subquery using 1 table Pin
AspDotNetDev16-Oct-12 11:25
protectorAspDotNetDev16-Oct-12 11:25 
AnswerRe: subquery using 1 table Pin
Aadhar Joshi16-Oct-12 20:28
Aadhar Joshi16-Oct-12 20:28 
GeneralRe: subquery using 1 table Pin
john john mackey17-Oct-12 4:38
john john mackey17-Oct-12 4:38 
QuestionHigh Number of Lock Requests Pin
cjb11016-Oct-12 3:23
cjb11016-Oct-12 3:23 
AnswerRe: High Number of Lock Requests Pin
Eddy Vluggen17-Oct-12 0:17
professionalEddy Vluggen17-Oct-12 0:17 
QuestionSQL Select Where query Pin
Joe Stansfield15-Oct-12 0:37
Joe Stansfield15-Oct-12 0:37 
AnswerRe: SQL Select Where query Pin
Eddy Vluggen15-Oct-12 0:57
professionalEddy Vluggen15-Oct-12 0:57 
GeneralRe: SQL Select Where query Pin
Joe Stansfield15-Oct-12 1:15
Joe Stansfield15-Oct-12 1:15 
GeneralRe: SQL Select Where query Pin
Eddy Vluggen15-Oct-12 1:22
professionalEddy Vluggen15-Oct-12 1:22 
GeneralRe: SQL Select Where query Pin
Joe Stansfield15-Oct-12 1:28
Joe Stansfield15-Oct-12 1:28 
AnswerRe: SQL Select Where query Pin
Eddy Vluggen15-Oct-12 2:15
professionalEddy Vluggen15-Oct-12 2:15 
GeneralRe: SQL Select Where query Pin
Joe Stansfield15-Oct-12 10:48
Joe Stansfield15-Oct-12 10:48 
GeneralRe: SQL Select Where query Pin
fjdiewornncalwe15-Oct-12 11:06
professionalfjdiewornncalwe15-Oct-12 11:06 
GeneralRe: SQL Select Where query Pin
Joe Stansfield16-Oct-12 0:08
Joe Stansfield16-Oct-12 0:08 
GeneralRe: SQL Select Where query Pin
Eddy Vluggen16-Oct-12 0:12
professionalEddy Vluggen16-Oct-12 0:12 

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.