Click here to Skip to main content
15,883,990 members
Home / Discussions / Database
   

Database

 
AnswerRe: calling stored procedure in case statement - Sql Server 2000 Pin
The Man from U.N.C.L.E.3-Mar-10 1:43
The Man from U.N.C.L.E.3-Mar-10 1:43 
AnswerRe: calling stored procedure in case statement - Sql Server 2000 Pin
Pranay Rana3-Mar-10 19:04
professionalPranay Rana3-Mar-10 19:04 
GeneralRe: calling stored procedure in case statement - Sql Server 2000 Pin
Mycroft Holmes3-Mar-10 21:29
professionalMycroft Holmes3-Mar-10 21:29 
AnswerRe: calling stored procedure in case statement - Sql Server 2000 Pin
The Man from U.N.C.L.E.3-Mar-10 22:48
The Man from U.N.C.L.E.3-Mar-10 22:48 
QuestionWhats wrong with SQL statement? Pin
gengel2-Mar-10 19:47
gengel2-Mar-10 19:47 
AnswerRe: Whats wrong with SQL statement? [modified] Pin
Jörgen Andersson2-Mar-10 21:48
professionalJörgen Andersson2-Mar-10 21:48 
AnswerRe: Whats wrong with SQL statement? Pin
i.j.russell2-Mar-10 22:04
i.j.russell2-Mar-10 22:04 
GeneralRe: Whats wrong with SQL statement? Pin
gengel2-Mar-10 22:46
gengel2-Mar-10 22:46 
Hi,

Thanks for the replies.

This query only seems to make a 1 to 1 join.

So if there is only one log entry it returns both SHIPPED and PACKED as 1 instead of 1294.

ProductionNo SHIPPED PACKED
10007627289 1 1

if i remove:
WHERE (UNITS.ScanStatus = 'SHIPPED') AND (UNIT_Logs.Old_Status = 'PACKED')

ProductionNo SHIPPED PACKED
10007627289 1294 1294

I tried this mess. Will try a few more options with this.
SELECT UNITS.ProductionNo, COUNT(UNITS.SerialNo) AS SHIPPED
FROM UNITS
WHERE UNITS.Scanstatus='SHIPPED' AND
(SELECT COUNT(UNIT_Logs.SerialNo) AS PACKED FROM UNIT_Logs WHERE UNIT_Logs.Old_Status='PACKED')
GROUP BY UNITS.ProductionNo
GeneralRe: Whats wrong with SQL statement? [modified] Pin
i.j.russell2-Mar-10 23:35
i.j.russell2-Mar-10 23:35 
GeneralRe: Whats wrong with SQL statement? Pin
gengel3-Mar-10 1:14
gengel3-Mar-10 1:14 
GeneralRe: Whats wrong with SQL statement? Pin
gengel3-Mar-10 1:17
gengel3-Mar-10 1:17 
GeneralRe: Whats wrong with SQL statement? Pin
i.j.russell3-Mar-10 2:00
i.j.russell3-Mar-10 2:00 
QuestionPermission sp_rename Pin
Clas Andersson2-Mar-10 7:23
Clas Andersson2-Mar-10 7:23 
AnswerRe: Permission sp_rename Pin
Mycroft Holmes2-Mar-10 10:52
professionalMycroft Holmes2-Mar-10 10:52 
QuestionSql issue.. Pin
<<Tash18>>1-Mar-10 21:05
<<Tash18>>1-Mar-10 21:05 
AnswerRe: Sql issue.. Pin
J4amieC1-Mar-10 21:15
J4amieC1-Mar-10 21:15 
GeneralRe: Sql issue.. Pin
<<Tash18>>1-Mar-10 22:44
<<Tash18>>1-Mar-10 22:44 
GeneralRe: Sql issue.. Pin
J4amieC1-Mar-10 23:05
J4amieC1-Mar-10 23:05 
QuestionShould I index this? Pin
Mike6543211-Mar-10 9:22
Mike6543211-Mar-10 9:22 
AnswerRe: Should I index this? Pin
Luc Pattyn1-Mar-10 9:34
sitebuilderLuc Pattyn1-Mar-10 9:34 
GeneralRe: Should I index this? Pin
Mike6543211-Mar-10 9:42
Mike6543211-Mar-10 9:42 
GeneralRe: Should I index this? Pin
David Mujica1-Mar-10 10:20
David Mujica1-Mar-10 10:20 
GeneralRe: Should I index this? Pin
Mike6543211-Mar-10 20:30
Mike6543211-Mar-10 20:30 
QuestionLooking for a book on SSIS Pin
Corporal Agarn1-Mar-10 6:30
professionalCorporal Agarn1-Mar-10 6:30 
QuestionConcatenating strings in MS SQL Pin
#Jet1-Mar-10 1:05
#Jet1-Mar-10 1:05 

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.