Click here to Skip to main content
15,889,200 members
Home / Discussions / Database
   

Database

 
GeneralRe: Using Pooling or SqlConnection object variable is better ? Pin
Richard Deeming26-Jan-17 1:38
mveRichard Deeming26-Jan-17 1:38 
GeneralRe: Using Pooling or SqlConnection object variable is better ? Pin
MrKBA26-Jan-17 1:39
MrKBA26-Jan-17 1:39 
QuestionRegularExpressions in SQL Server Pin
indian14323-Jan-17 12:50
indian14323-Jan-17 12:50 
AnswerRe: RegularExpressions in SQL Server Pin
Richard MacCutchan23-Jan-17 21:52
mveRichard MacCutchan23-Jan-17 21:52 
AnswerRe: RegularExpressions in SQL Server Pin
Richard Deeming24-Jan-17 2:29
mveRichard Deeming24-Jan-17 2:29 
QuestionSQl, Oracle Database Pin
Member 1295956019-Jan-17 23:59
Member 1295956019-Jan-17 23:59 
SuggestionRe: SQl, Oracle Database Pin
ZurdoDev24-Jan-17 3:20
professionalZurdoDev24-Jan-17 3:20 
QuestionJOIN Problem Pin
Kevin Marois19-Jan-17 9:01
professionalKevin Marois19-Jan-17 9:01 
SQL 2012:

I have two tables, AttemptedRuns and Bays

This
SELECT * 
    FROM NexGen.dbo.AttemptedRuns
    WHERE BaySerialNumber = '1545300531'
Produces 317 rows. The table has a column called 'BaySerialNumber'

So I want to join on bays so I can retrieve the BayLocation:
SELECT  ar.Id as AttemptedRunId,
        ar.AccessionId,
        ar.StartTime,
        ar.BaySerialNumber,
        ar.CartridgeId,
        ar.Result as AttemptedRunResult,
        b.Location as BayLocation
    FROM NexGen.dbo.AttemptedRuns ar
    LEFT JOIN NexGen.dbo.Bays b on b.SerialNumber = ar.BaySerialNumber
    WHERE ar.BaySerialNumber = '1545300531'

The problem is that I now get 1902 rows. It's duplicating the AttemptedRuns rows. See here

What I am looking for is to get the BayLocation from the Bays table for each AttemptedRow row.

What am I doing wrong??
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.

AnswerRe: JOIN Problem Pin
ZurdoDev19-Jan-17 9:22
professionalZurdoDev19-Jan-17 9:22 
GeneralRe: JOIN Problem Pin
Kevin Marois19-Jan-17 9:25
professionalKevin Marois19-Jan-17 9:25 
GeneralRe: JOIN Problem Pin
ZurdoDev19-Jan-17 9:30
professionalZurdoDev19-Jan-17 9:30 
GeneralRe: JOIN Problem Pin
Kevin Marois19-Jan-17 9:32
professionalKevin Marois19-Jan-17 9:32 
GeneralRe: JOIN Problem Pin
ZurdoDev19-Jan-17 9:35
professionalZurdoDev19-Jan-17 9:35 
GeneralRe: JOIN Problem Pin
Kevin Marois19-Jan-17 9:45
professionalKevin Marois19-Jan-17 9:45 
GeneralRe: JOIN Problem Pin
ZurdoDev19-Jan-17 9:50
professionalZurdoDev19-Jan-17 9:50 
GeneralRe: JOIN Problem Pin
Kevin Marois19-Jan-17 9:51
professionalKevin Marois19-Jan-17 9:51 
GeneralRe: JOIN Problem Pin
Eddy Vluggen19-Jan-17 9:38
professionalEddy Vluggen19-Jan-17 9:38 
GeneralRe: JOIN Problem Pin
ZurdoDev19-Jan-17 9:52
professionalZurdoDev19-Jan-17 9:52 
GeneralRe: JOIN Problem Pin
Eddy Vluggen19-Jan-17 10:03
professionalEddy Vluggen19-Jan-17 10:03 
QuestionI need some help from my fellow developers... Pin
Steve Naidamast12-Jan-17 3:44
professionalSteve Naidamast12-Jan-17 3:44 
AnswerRe: I need some help from my fellow developers... Pin
Richard MacCutchan12-Jan-17 4:19
mveRichard MacCutchan12-Jan-17 4:19 
GeneralRe: I need some help from my fellow developers... Pin
Steve Naidamast12-Jan-17 5:08
professionalSteve Naidamast12-Jan-17 5:08 
Questionvb.net, select where statement Pin
jkirkerx5-Jan-17 8:12
professionaljkirkerx5-Jan-17 8:12 
AnswerRe: vb.net, select where statement Pin
Wendelius5-Jan-17 8:30
mentorWendelius5-Jan-17 8:30 
GeneralRe: vb.net, select where statement Pin
jkirkerx5-Jan-17 8:39
professionaljkirkerx5-Jan-17 8:39 

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.