Click here to Skip to main content
16,005,290 members
Home / Discussions / Database
   

Database

 
AnswerRe: Help with a SELECT query needed. Pin
PIEBALDconsult12-Aug-08 3:29
mvePIEBALDconsult12-Aug-08 3:29 
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 
hi tim

problem is...I dont want to do anything with them apart from get the values in the same way you do in MySQL, I just want to get rid of the duplicates that get pulled based on certain criteria.

this is what I'm converting:

SELECT 

'PI' as transaction_type,
supplier_codes.supplier_code,
supplier_codes.nominal_code,
COUNT(o.orderline_id) as sale_volume,
IF ( EXTRACT(MONTH FROM STR_TO_DATE(CONCAT(YEARWEEK(dispatch_date),'0'),'%x%v%w')) = MONTH(dispatch_date),
     DATE_FORMAT(STR_TO_DATE(CONCAT(YEARWEEK(dispatch_date),'0'),'%x%v%w'),'%d/%m/%Y'),
     DATE_FORMAT(STR_TO_DATE(CONCAT('01/',EXTRACT(MONTH FROM dispatch_date),'/',YEAR(dispatch_date)),'%d/%m/%Y'),'%d/%m/%Y'))  as my_dispatch_date,

resource.name as resourcename,
resource.reference,
SUM(supplier_codes.license_fee) as royalty_amount,
tax_codes.code,
ROUND(((SUM(supplier_codes.license_fee) / 100) * tax_codes.multiplier),2) as tax_amount,
"1" as blank_field_2,
"_" as blank_field_3,
"_" as blank_field_4


FROM order_line o

LEFT JOIN resource ON o.resource_id = resource.resource_id
LEFT JOIN supplier_codes ON resource.reference = supplier_codes.reference
LEFT JOIN partners ON supplier_codes.partner_id = partners.partner_id
LEFT JOIN partner_type ON supplier_codes.partner_type_id = partner_type.partner_type_id
LEFT JOIN tax_codes ON partners.tax_code = tax_codes.id

WHERE   supplier_codes.payment_start_date <= dispatch_date  
AND   supplier_codes.payment_end_date >= dispatch_date
AND   o.status = 1
AND   DATE_FORMAT(o.dispatch_date,'%Y-%m-%d') >= '$from'
AND   DATE_FORMAT(o.dispatch_date,'%Y-%m-%d') < '$to'
AND   o.dm !='ZX'

GROUP BY reference, supplier_code, my_dispatch_date
ORDER BY dispatch_date, reference


dont worry about the difference in some of the vars in it, its only the group by thats doing my head in
GeneralRe: MySQL to MSSQL conversion of stmt Pin
Tim Carmichael12-Aug-08 3:06
Tim Carmichael12-Aug-08 3:06 
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 

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.