How do I concat this in MSSQL? Really need help!!

Discussion in 'MySQL' started by motoxcr17, Mar 31, 2008.

  1. #1
    Im trying to export for my online store the shipping information to import into fedex... heres what my query looks like:

    sp_PagedItems 1, 50, '', '', '', 'SELECT o.LastModified, o.LastModBy, :confused:rderStatus, :confused:rderID, :confused:rderDate, o.ShipDate, o.PaymentAmount, o.Total_Payment_Authorized, o.Total_Payment_Received, o.CustomerID, o.Locked, o.Printed, o.CreditCardAuthorizationDate, o.Shipped, o.PaymentDeclined, o.SalesTaxRate1, o.SalesTaxRate2, o.SalesTaxRate3, o.SalesTax1, o.SalesTax2, o.SalesTax3, o.Tax1_Title, o.Tax2_Title, o.Tax3_Title, o.TotalShippingCost, o.BatchNumber, :confused:rder_Entry_System, o.SalesRep_CustomerID,o.Custom_Field_Custom1,o.Custom_Field_Custom2,o.Custom_Field_Custom3,o.Custom_Field_Custom4,o.Custom_Field_Custom5 , (SELECT Customers.EmailAddress FROM Customers WHERE Customers.CustomerID = o.CustomerID) As EmailAddress , SELECT o.ShipFirstName + " " + o.ShipLastName AS ShipName, o.ShipAddress1, o.ShipAddress2, o.ShipCity, o.ShipState, o.ShipPostalCode, o.ShipCountry, o.ShipPhoneNumber, o.ShipFaxNumber, o.ShipResidential, o.ShippingMethodID ,o.BillingCompanyName, o.BillingFirstName, o.BillingLastName, o.BillingAddress1, o.BillingAddress2, o.BillingCity, o.BillingState, o.BillingPostalCode, o.BillingCountry, o.BillingPhoneNumber, o.BillingFaxNumber , (SELECT PaymentMethod FROM PaymentMethods WHERE PaymentMethods.PaymentMethodID = o.PaymentMethodID) As PaymentMethod, OrderDetails.Quantity, OrderDetails.QtyOnBackOrder, OrderDetails.QtyOnHold, OrderDetails.QtyShipped, (SELECT TOP 1 Pay_AVS_Response FROM Payment_Log WHERE Pay_OrderID = :confused:rderID AND IsNull(Deleted,''N'') <> ''Y'' AND (Pay_Result = ''AUTHORIZE'' OR Pay_Result = ''DEBIT'')) AS Payment_Log_AVS_Response, (SELECT TOP 1 Pay_CVV2_Response FROM Payment_Log WHERE Pay_OrderID = :confused:rderID AND IsNull(Deleted,''N'') <> ''Y'' AND (Pay_Result = ''AUTHORIZE'' OR Pay_Result = ''DEBIT'')) AS Payment_Log_CVV2_Response FROM Orders o LEFT JOIN ( SELECT OrderID, Sum(Quantity) As Quantity, Sum(QtyOnBackOrder) As QtyOnBackOrder, Sum(QtyOnHold) As QtyOnHold, Sum(QtyShipped) As QtyShipped FROM OrderDetails GROUP BY OrderID ) OrderDetails ON :confused:rderID = OrderDetails.OrderID WHERE 1=1 AND :confused:rderStatus <> ''Shipped'' AND :confused:rderStatus <> ''Cancelled'' AND :confused:rderStatus <> ''Returned'' AND :confused:rderStatus <> ''Partially Returned'' ORDER BY :confused:rderID DESC '

    The part in bold is where im getting the error, any help would be greatly appreciated, thanks!
     
    motoxcr17, Mar 31, 2008 IP
  2. motoxcr17

    motoxcr17 Peon

    Messages:
    325
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    if someone can help me I will paypal them $10 right now if I can get this SQL how i want it
     
    motoxcr17, Apr 1, 2008 IP
  3. Petey

    Petey Peon

    Messages:
    68
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi motoxcr17,

    You need to use the concat() function.

    Rewrite SELECT o.ShipFirstName + " " + o.ShipLastName AS ShipName to SELECT concat(o.ShipFirstName ," ",o.ShipLastName) AS ShipName and it should work.

    HTH

    Petey
     
    Petey, Apr 2, 2008 IP
  4. $$andrew

    $$andrew Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    first care fuly install.. and read manual of mysql.com/

    even there problem please contact to infoseeksoftwaresystems

    Regards
    Andrew
     
    $$andrew, Apr 2, 2008 IP