Click here to Skip to main content
15,926,857 members
Home / Discussions / Database
   

Database

 
GeneralRe: Help with a SELECT query needed. Pin
Steven J Jowett12-Aug-08 3:31
Steven J Jowett12-Aug-08 3:31 
GeneralRe: Help with a SELECT query needed. Pin
Steven J Jowett12-Aug-08 4:32
Steven J Jowett12-Aug-08 4:32 
GeneralRe: Help with a SELECT query needed. Pin
PIEBALDconsult12-Aug-08 5:10
mvePIEBALDconsult12-Aug-08 5:10 
GeneralRe: Help with a SELECT query needed. Pin
Steven J Jowett12-Aug-08 5:45
Steven J Jowett12-Aug-08 5:45 
QuestionMySQL to MSSQL conversion of stmt Pin
tim_gunning12-Aug-08 1:54
tim_gunning12-Aug-08 1:54 
AnswerRe: MySQL to MSSQL conversion of stmt Pin
Tim Carmichael12-Aug-08 2:13
Tim Carmichael12-Aug-08 2:13 
GeneralRe: MySQL to MSSQL conversion of stmt Pin
tim_gunning12-Aug-08 2:25
tim_gunning12-Aug-08 2:25 
GeneralRe: MySQL to MSSQL conversion of stmt Pin
Tim Carmichael12-Aug-08 3:06
Tim Carmichael12-Aug-08 3:06 
Ok.... in SQLServer, a group by is used if there are any aggregate fields (sum, count, etc).
In your original query (from MySQL), there is a COUNT and 2 SUM aggregate fields.
If you want the sales volumne (COUNT), royalty amount (SUM) and tax amount (SUM) in your SQLServer query, GROUP BY any non-aggregate fields:
GROUP BY supplier_codes.supplier_code, supplier_codes.nominal_code, resource.name, resource.reference, tax_codes.code

The GROUP BY clause must go after the WHERE and before the ORDER BY

If you are currently getting duplicate records, change the SELECT to SELECT DISTINCT.

Hope that helps...

Tim
GeneralRe: MySQL to MSSQL conversion of stmt Pin
tim_gunning12-Aug-08 3:24
tim_gunning12-Aug-08 3:24 
QuestionNot returning null values Pin
Brendan Vogt12-Aug-08 1:41
Brendan Vogt12-Aug-08 1:41 
AnswerRe: Not returning null values Pin
Ashfield12-Aug-08 2:05
Ashfield12-Aug-08 2:05 
QuestionRe: Not returning null values Pin
Brendan Vogt12-Aug-08 21:08
Brendan Vogt12-Aug-08 21:08 
AnswerRe: Not returning null values Pin
PIEBALDconsult12-Aug-08 3:34
mvePIEBALDconsult12-Aug-08 3:34 
AnswerRe: Not returning null values Pin
PIEBALDconsult12-Aug-08 3:36
mvePIEBALDconsult12-Aug-08 3:36 
GeneralRe: Not returning null values Pin
Ashfield12-Aug-08 5:20
Ashfield12-Aug-08 5:20 
GeneralRe: Not returning null values Pin
PIEBALDconsult12-Aug-08 7:31
mvePIEBALDconsult12-Aug-08 7:31 
GeneralRe: Not returning null values Pin
Ashfield12-Aug-08 19:51
Ashfield12-Aug-08 19:51 
GeneralRe: Not returning null values Pin
PIEBALDconsult13-Aug-08 3:13
mvePIEBALDconsult13-Aug-08 3:13 
QuestionDB Exception while open Pin
krishnan.s12-Aug-08 1:20
krishnan.s12-Aug-08 1:20 
QuestionSearching on 1 of 2 fields [modified] Pin
Brendan Vogt11-Aug-08 23:32
Brendan Vogt11-Aug-08 23:32 
AnswerRe: Searching on 1 of 2 fields Pin
balamurugansekhar11-Aug-08 23:46
balamurugansekhar11-Aug-08 23:46 
QuestionRe: Searching on 1 of 2 fields Pin
Brendan Vogt11-Aug-08 23:55
Brendan Vogt11-Aug-08 23:55 
AnswerRe: Searching on 1 of 2 fields Pin
balamurugansekhar12-Aug-08 0:32
balamurugansekhar12-Aug-08 0:32 
GeneralRe: Searching on 1 of 2 fields Pin
balamurugansekhar12-Aug-08 0:33
balamurugansekhar12-Aug-08 0:33 
AnswerRe: Searching on 1 of 2 fields Pin
neilarnold12-Aug-08 0:21
neilarnold12-Aug-08 0:21 

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.