Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Update resulting query

Author  Topic 

marcelo73
Starting Member

14 Posts

Posted - 2006-11-22 : 16:58:26
How can I update the the results of a query?

The query is this one:
select distinct num_bol_depos, importe_cheque from tbl2_boletas_uniplus

and I want to set nodup=1 to every resulting row

I mean, I cannot do this:
update tbl2_boletas_uniplus
set nodup=1
where (select distinct num_bol_depos, importe_cheque from tbl2_boletas_uniplus)

Is there a way?

Thanks in advance, Marcelo.

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-11-22 : 17:12:23
You haven't defined any criteria for selecting specific rows, so you would be updatomg all rows like this:
update tbl2_boletas_uniplus set nodup=1

I suspect this is not what you want, so you need to explain what you are trying to do.


CODO ERGO SUM
Go to Top of Page

marcelo73
Starting Member

14 Posts

Posted - 2006-11-22 : 17:48:01
What I mean is that I want to set a 1 at nodup field where this condition:
select distinct num_bol_depos, importe_cheque from tbl2_boletas_uniplus

My table has 29.599 rows

If I run the query it has 15.401 rows.

I want to set nodup=1 just at those rows.

Hope I was clear enough.

Thanks in advance, Marcelo.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-11-22 : 17:57:32
quote:
Originally posted by marcelo73

What I mean is that I want to set a 1 at nodup field where this condition:
select distinct num_bol_depos, importe_cheque from tbl2_boletas_uniplus

My table has 29.599 rows

If I run the query it has 15.401 rows.

I want to set nodup=1 just at those rows.

Hope I was clear enough.

Thanks in advance, Marcelo.



The point is that this query does not select any specific rows in the table; it selects all the rows in the table.
select distinct num_bol_depos, importe_cheque from tbl2_boletas_uniplus

I hope this is clear.



CODO ERGO SUM
Go to Top of Page

marcelo73
Starting Member

14 Posts

Posted - 2006-11-22 : 18:04:18
Michael, my problem is that I'm trying to look for a walk around to my problem. Not to write it all down here and closing this subject I'd like you to take a look at my thread where I explain my whole problem.
Hope you can help me. Marcelo.

Post: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75316
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-11-22 : 18:08:31
quote:
Originally posted by marcelo73

Michael, my problem is that I'm trying to look for a walk around to my problem. Not to write it all down here and closing this subject I'd like you to take a look at my thread where I explain my whole problem.
Hope you can help me. Marcelo.

Post: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=75316



You wasted my time by starting a new topic, instead of posting on your original thread. That is extremely rude, so I am done here.






CODO ERGO SUM
Go to Top of Page

marcelo73
Starting Member

14 Posts

Posted - 2006-11-22 : 18:15:42
Michael, I was looking for another way of solving a problem I'm having. How is it possible then if you give me a second option to make you waste your time?
I'm sorry Michael but imagine I'm not coming here to make anyone waste his/her time. All the opposite. This was my problem now and I'm looking for help. I accept you don't want to keep on helping me but I don't agree with you.
Hope you understand.
Thanks anyway, Marcelo.
Go to Top of Page
   

- Advertisement -