Monday, February 27, 2012

Help me with this query

Hi All,

I have to table, Order and OrderPayment, and the schema looks like this:

Order
----
OrderID,
InvoiceDT,
InvoiceTotal

OrderPayment
--------
PaymentID
OrderID
PaymentAmount
PaymentDT

And I want to get all the order with Invoice DT Between certain date. Here is my query:

SELECT

o.OrderID,

o.InvoiceDT, o.InvoiceTotal,

op.PaymentAmount

FROM

[Order] o

LEFTJOIN[OrderPayment] opON op.OrderID= o.OrderID

WHERE

o.InvoiceDTISNOTNULLAND

(o.InvoiceDTBETWEEN'09/01/2006'AND'09/20/2006')

But I get two results with the same orderID, eventhough I use GROUP BY

Any idea...

Try something like this

SELECT o.OrderID,o.InvoiceDT, o.InvoiceTotal,op.PaymentAmount

FROM [Order] o
LEFT JOIN (Select orderID, sum(paymentamount) PaymentAmount from [OrderPayment] group by orderid) op ON op.OrderID = o.OrderID
WHERE o.InvoiceDT IS NOT NULL AND (o.InvoiceDT BETWEEN '09/01/2006' AND '09/20/2006')
group by o.OrderID,o.InvoiceDT,o.InvoiceTotal

|||Thanks, it works...

Help me with this problem, please!

I have a question..
I had to put times in this process but I don't have idea
how to do this.
The enterprise use SQL Server 2000 and pages ASP, and
their server is in Corea.
Could be by DTS in SQL server, but I'm not sure it it
possible with DTS..
Section, send automatically post card
This process send post card in birthdays of employees.
This will run dialy for to send automatically post card to
employes who is him birthday that day..
Somebody knows how to do that and could be recommend
another way if it's not possible with DTS..
Please, send me the answer to my mail
bmartinez@.cosapisoft.com.pe
Thanks anyway
Grettings
BrunoDepending on the setup you have to accomplish this task,
you can use a DTS package scheduled every day to execute
the send postcard process.
Please let me know if you have any questions.
Edgardo Valdez
MCSD, MCDBA, MCSE, MCP+I
http://www.edgardovaldez.us/
>--Original Message--
>I have a question..
>I had to put times in this process but I don't have idea
>how to do this.
>The enterprise use SQL Server 2000 and pages ASP, and
>their server is in Corea.
>Could be by DTS in SQL server, but I'm not sure it it
>possible with DTS..
>Section, send automatically post card
>This process send post card in birthdays of employees.
>This will run dialy for to send automatically post card
to
>employes who is him birthday that day..
>Somebody knows how to do that and could be recommend
>another way if it's not possible with DTS..
>Please, send me the answer to my mail
>bmartinez@.cosapisoft.com.pe
>Thanks anyway
>Grettings
>Bruno
>
>.
>

Help me with this error wmi task

i set up a WMI Reader Task which works perfectly fine.

But when i Use WMI event watcher i get this error.

if the problem is with access rights how do i need to set or how can i figure out if i have rights..

[WMI Event Watcher Task] Error: Watching for the Wql query caused the following system exception: "Invalid class". Check the query for errors or WMI connection for access rights/permissions.

What is the WQL query you are trying to execute and on what OS/architechture? Some WMI classes are available on Vista, Windows 2003, and not on XP, and vice versa.

Help me with this error

I am transferring from oledb datasoure to flat file destination.

I get the following error.I am having this problem at mappings in the flat file.

I get this error.i have only one datasoure.please le t me know about this.


Error at Data Flow Task 1 [Flat File Destination [631]]: There is more than one data source column with the name "ErrorCode". The data source column names must be unique.

You cannot have a source column, or a destination column with the name of ErrorCode.

You *can* have a destination column named ErrorCode, but only if that destination is hooked up to the error output path.

Never-the-less, I filed a bug on this, though it may or may not be a bug depending on your perspective:
https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=252471|||I get that.But i dont have incoming comlum errorcode in the source or the destination.I am telling this based on what i see.I dont see the columns.|||

sureshv wrote:

I get that.But i dont have incoming comlum errorcode in the source or the destination.I am telling this based on what i see.I dont see the columns.

Better double check the flat file connection manager column names. There's an ErrorCode column being introduced somewhere that isn't appropriate.|||Also double click on the arrow that goes into the destination flat file and check if you see the errocode column that is causing the issue.

Help me with SQL Statement

Hello, i want to make SQL statement for Restore databse that selects the
..bak file from the same .sql file path ,something like '..\' in the
javascript, plz help and thank you ..
The restore database requires absolute path. You have to determine the path
and form the restore statement.
-oj
"Samy Hamdy" <samy_hamdy@.hotmail.com> wrote in message
news:OGCsE1KfFHA.3612@.TK2MSFTNGP12.phx.gbl...
> Hello, i want to make SQL statement for Restore databse that selects the
> .bak file from the same .sql file path ,something like '..\' in the
> javascript, plz help and thank you ..
>
|||Thank you very much ..

Help me with SQL Statement

Hello, i want to make SQL statement for Restore databse that selects the
.bak file from the same .sql file path ,something like '..\' in the
javascript, plz help and thank you ..The restore database requires absolute path. You have to determine the path
and form the restore statement.
-oj
"Samy Hamdy" <samy_hamdy@.hotmail.com> wrote in message
news:OGCsE1KfFHA.3612@.TK2MSFTNGP12.phx.gbl...
> Hello, i want to make SQL statement for Restore databse that selects the
> .bak file from the same .sql file path ,something like '..' in the
> javascript, plz help and thank you ..
>|||Thank you very much ..

Help me with SQL Statement

Hello, i want to make SQL statement for Restore databse that selects the
.bak file from the same .sql file path ,something like '..\' in the
javascript, plz help and thank you ..The restore database requires absolute path. You have to determine the path
and form the restore statement.
--
-oj
"Samy Hamdy" <samy_hamdy@.hotmail.com> wrote in message
news:OGCsE1KfFHA.3612@.TK2MSFTNGP12.phx.gbl...
> Hello, i want to make SQL statement for Restore databse that selects the
> .bak file from the same .sql file path ,something like '..\' in the
> javascript, plz help and thank you ..
>|||Thank you very much ..