Jump to content

Recommended Posts

Posted

ee  select query ni update statement ki convert cheyali 

 

select distinct(s.ID),MAX(s.EndDate) as FeePaid,p.Paid

from Db..Person p

inner join Db..vwstudent s on p.ID = s.ID

where s.Product= 1 

group by s.ID,p.Paid

having MAX(s.EndDate) <> p.Paid

 

something like with the select condition ? 

 

 

--update Db..Person set p.Paid = MAX(s.EndDate)

 

select distinct(s.ID),MAX(s.EndDate) as FeePaid,p.Paid

from Db..Person p

inner join Db..vwstudent s on p.ID = s.ID

where s.Product= 1 

group by s.ID,p.Paid

having MAX(s.EndDate) <> p.Paid

Posted

simple thing google chesi chesukovachu anni memu chebthe nuvvendhi nerchukunedhi bandla.gif

Posted

UPDATE
Table
SET
Table.col1 = other_table.col1,
Table.col2 = other_table.col2
FROM
Table
INNER JOIN
other_table
ON
Table.id = other_table.id

 

 

Try this

Posted

simple thing google chesi chesukovachu anni memu chebthe nuvvendhi nerchukunedhi bandla.gif

 

already try chesanu in different ways  but  i keep getting error "the multi part  identifier  could not be bound  " 

Posted

idedo anukuntunna,,,,,,,

 

update Db..Person set (db.ID,db.EndDate)  = (

 select distinct(s.ID),MAX(s.EndDate) as FeePaid,p.Paid

from Db..Person p

inner join Db..vwstudent s on p.ID = s.ID

where s.Product= 1 

group by s.ID,p.Paid

having MAX(s.EndDate) <> p.Paid

)

where exists (select 'x' from from Db..Person p

inner join Db..vwstudent s on p.ID = s.ID

where s.Product= 1 

group by s.ID,p.Paid

having MAX(s.EndDate) <> p.Paid )

Posted

already try chesanu in different ways  but  i keep getting error "the multi part  identifier  could not be bound  " 

a error ardham anna telusa neeku ? ekkado field ni wrong alias tho call chesthunav adhi choodu mundhubandla.gif

Posted

a error ardham anna telusa neeku ? ekkado field ni wrong alias tho call chesthunav adhi choodu mundhubandla.gif

Dale steyn baa... kaastha cool avvu.

Posted

a error ardham anna telusa neeku ? ekkado field ni wrong alias tho call chesthunav adhi choodu mundhubandla.gif

antha satirical reply enduku ?   naku antha knowledge unte ikada enduku question vesthanu  I am still learning. 

Posted

UPDATE
Table
SET
Table.col1 = other_table.col1,
Table.col2 = other_table.col2
FROM
Table
INNER JOIN
other_table
ON
Table.id = other_table.id

 

 

Try this

 

I did try like this group by condition midha error avthundi  and order by add chesina same error 

Posted

 

ee  select query ni update statement ki convert cheyali 

 

select distinct(s.ID),MAX(s.EndDate) as FeePaid,p.Paid

from Db..Person p

inner join Db..vwstudent s on p.ID = s.ID

where s.Product= 1 

group by s.ID,p.Paid

having MAX(s.EndDate) <> p.Paid

 

something like with the select condition ? 

 

 

--update Db..Person set p.Paid = MAX(s.EndDate)

 

select distinct(s.ID),MAX(s.EndDate) as FeePaid,p.Paid

from Db..Person p

inner join Db..vwstudent s on p.ID = s.ID

where s.Product= 1 

group by s.ID,p.Paid

having MAX(s.EndDate) <> p.Paid

 

 

Yesuko updatuuuu

 

update up
Set Paid = FeePaid
from db..Person up
inner join
(
select distinct(s.ID),MAX(s.EndDate) as FeePaid,p.Paid
from Db..Person p
inner join Db..vwstudent s on p.ID = s.ID
where s.Product= 1
group by s.ID,p.Paid
having MAX(s.EndDate) <> p.Paid
) dp
on up.ID = Dp.ID
 

Posted

UPDATE p
SET p.paid = MAX(s.EndDate)
from Db..Person p
inner join Db..vwstudent s on p.ID = s.ID
where s.Product= 1 
group by s.ID,p.Paid
having MAX(s.EndDate) <> p.Paid
 
Multi-part identifier error antey, if you have specified an alias in your query and you are using different alias somewhere else SQL is not able to find that identifier and so doesn't know what to do and throws an error to you... simple..
 
PK-3.gif
×
×
  • Create New...