Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

update query help

 
   Database Help (Home) -> Programming RSS
Next:  which sqlcedatareader method should I call for a ..  
Author Message
Jami

External


Since: Apr 14, 2008
Posts: 22



(Msg. 1) Posted: Wed Jul 14, 2010 5:08 am
Post subject: update query help
Archived from groups: microsoft>public>sqlserver>programming (more info?)

sql 2000

i have three tables

1- create table mytab(id_no varchar(5), Counter smallint))
2- create table Rectab(id_no varchar(5), refno smallint))
3- create table Lib_tab(refno smallint)

insert into mytab values(1,null)
insert into mytab values(2,null)
insert into mytab values(3,null)
insert into mytab values(4,null)

-- Rectab has duplicate values

insert into Rectab values(1,1)
insert into Rectab values(1,1)
insert into Rectab values(1,2)
insert into Rectab values(1,2)
insert into Rectab values(1,2)
insert into Rectab values(1,3)
insert into Rectab values(2,1)
insert into Rectab values(2,1)
insert into Rectab values(3,2)
insert into Rectab values(3,2)
insert into Rectab values(3,2)
insert into Rectab values(3,3)
insert into Rectab values(4,3)
insert into Rectab values(4,3)
insert into Rectab values(4,2)
insert into Rectab values(4,1)
insert into Rectab values(4,1)

---Libtab Library table

insert into Lib_tab values(1)
insert into Lib_tab values(2)
insert into Lib_tab values(3)
insert into Lib_tab values(4)
insert into Lib_tab values(5)


i want to update mytab in manner that i want to get distinct count
(distinct id_no,refno) of rectab in counter column of my tab, vALUES of
refno MUST EXIST IN Lib_tab e.g out put should like

select * from mytab

id_no counter
1 3
2 1
3 2
4 3

what will be the update query



regards

*** Sent via Developersdex http://www.developersdex.com ***

 >> Stay informed about: update query help 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
Update query - Im trying to run an Update query that has a Criteria in it such as (tblZHoldOrderDetails_View.LOCATION IS NOT NULL) but what Im having a problem with is that I would like to make sure that the same field is not blank. For example in MS Access I could..

help for update query - Hi, I'm trying to do an update on a table, but I'm confronted to a difficult query. My tables: [Flag] { FlagID, Description } [FlagData] { FlagDataID, FlagID, DataDesc, DataValueStr} An example : Flag : FlagID = 104 Description = 'Martin Smyth'...

slow update query - a very basic situation, here's table definition: create table table1 (xid int identity, f varchar(20), f_std varchar(20)) go alter table table2 with no check add constraint pk_test2 primary key ( xid ) create table table2 (f varchar(20), f_std..

UPDATE query using a subquery - Hello everyone, I have searched but couldn't find something similiar to my issue. This is my table structure: CREATE TABLE [CARS] ( [id] [int] NOT NULL , [name] [char] (10), [brand] [char] (10), [model] [char] (10), CONSTRAINT [PK_CARS] PRIMARY KE...

ASP Update Query.... - Hello All, i would be greatfull if you can help me with the following, I've created a webpage that updates two columns of a table - all records that meet a set criteria. in this instance JBASiteID = "variable" and JBAInvoiced = 'n' whereby t...
   Database Help (Home) -> Programming All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You can edit your posts in this forum
You can delete your posts in this forum
You can vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]