Hi all, I am sanju,
To generate report I am using table named as "tempTest" for displaying
count of dealer.
On back end i am using oracle.
I am unable to insert the second qry
The datatype of the table is as follows
select * from tempTest
CREATE table tempTest
( DEALER_NAME varchar2(50),
DEALER_CODE varchar2(50),
DEALER_DATA INT,
MAIL_OUT varchar2(50)
)
--drop table tempTest;
------------------- /* Dealer Wise All Date [TO INSERT
DEALER_NAME,DEALER_CODE,DEALER_DATA}*/
INSERT INTO TEMPTEST (DEALER_NAME,DEALER_CODE,DEALER_DATA)
select Dealer_name ,DM.DEALER_CODE,count(Dealer_name) from CUSTMAST
A, DEALER_MASTER DM , MAHINDRA_DET MD
where Complete_status ='C' and A.REJECTED IS NULL AND MD.MODEL_GROUP
IN ('BOLERO','SCORPIO')
AND A.SOURCE_INFORMATION IN ('JD POWER SALES')
AND A.CUST_CODE=MD.CUST_CODE AND A.DEALER_CODE=DM.DEALER_CODE AND
MD.PURCHASE_DT
BETWEEN '01-Jul-2006' AND '30-Sep-2006'
Group by Dealer_name,DM.DEALER_CODE
order by Dealer_name
---- mail Out[TO UPDATE MAIL_OUT COLUNM]
UPDATE tempTest SET MIGRATED= Dealer_name ,count(Dealer_name) FROM
CUSTMAST A
INNER JOIN MAHINDRA_DET B ON A.CUST_CODE = B.CUST_CODE
INNER JOIN DEALER_MASTER DM ON A.DEALER_CODE=DM.DEALER_CODE
INNER JOIN SALES_TELECALLING_RESPONSE C ON A.CUST_CODE=C.CUST_CODE
WHERE B.MODEL_GROUP IN ('SCORPIO','BOLERO')
AND A.REJECTED IS NULL
AND (B.PURCHASE_DT BETWEEN '01-Jul-2006' AND '30-Sep-2006')
AND C.RESPONSE IN ('Y')
GROUP BY Dealer_name
----- NOT WORKING
Hugo Kornelis - 28 Sep 2006 20:53 GMT
>Hi all, I am sanju,
>To generate report I am using table named as "tempTest" for displaying
>count of dealer.
>On back end i am using oracle.
>I am unable to insert the second qry
>The datatype of the table is as follows
(snip)
>----- NOT WORKING
Hi Sanju,
Normally, I'd ask what "not working" means - runs but incorrect results,
doesn't run but yields error message, runs forever without returning,
causes black smoke to come from the server - what?
In this case, though, I see at least one problem:
>UPDATE tempTest SET MIGRATED= Dealer_name ,count(Dealer_name) FROM
You have one column name on the left of SET, but two expressions on the
right. You either need
SET Column = expression
or
SET Column = expression, Other_Column = other_expression
I can't tell if this is the only problem in your code, since I have no
idea how your tables look like, what data is in your tables and what
results you need. So if you need further assistance, I suggest that you
post the following:
- Table structures, posted as CREATE TABLE statements. You may omit
columns that are irrelevant for the question, but please do include all
constraints, properties, and indexes.
- Some rows of sample data, posted as INSERT statements. You don't have
to post thousands of rows - just a few wel-chosen rows to illustrate the
problem suffices. You don't have to post real data either (as you might
be in a business where yoou're not allowed to disclose real data), but
make it realistic.
- Expected results. If you post in the form of a table, please switch to
a fixed-width font before formatting the table and use spaces rather
than tabs to format your data - this is the only way to be sure that
your data looks as good on my screen as it does on yours.
Check out www.aspfaq.com/5006 for more info

Signature
Hugo Kornelis, SQL Server MVP
Ed Murphy - 29 Sep 2006 03:10 GMT
> On back end i am using oracle.
Then why are you posting to a Microsoft SQL newsgroup?
> I am unable to insert the second qry
[snip]
> UPDATE tempTest SET MIGRATED= Dealer_name ,count(Dealer_name) FROM
I agree with Hugo, this looks like the problem. At a guess, you
should change this to
UPDATE tempTest
SET MIGRATED = Dealer_name, DEALER_DATA = count(Dealer_name)
FROM (etc.)