Click here to Skip to main content
12,625,402 members (35,999 online)
   

Database

 
AnswerRe: SQL Server 2008 Pin
Shameel10-Feb-13 23:33
memberShameel10-Feb-13 23:33 
AnswerRe: SQL Server 2008 Pin
jschell11-Feb-13 9:20
memberjschell11-Feb-13 9:20 
Questionupdate values in a table in single query Pin
nainakarri7-Feb-13 21:07
membernainakarri7-Feb-13 21:07 
AnswerRe: update values in a table in single query Pin
Mycroft Holmes7-Feb-13 22:00
memberMycroft Holmes7-Feb-13 22:00 
GeneralRe: update values in a table in single query Pin
Shameel10-Feb-13 23:38
memberShameel10-Feb-13 23:38 
GeneralRe: update values in a table in single query Pin
Mycroft Holmes11-Feb-13 14:30
memberMycroft Holmes11-Feb-13 14:30 
AnswerRe: update values in a table in single query Pin
Eddy Vluggen7-Feb-13 23:42
mvpEddy Vluggen7-Feb-13 23:42 
GeneralRe: update values in a table in single query Pin
gvprabu10-Feb-13 19:02
membergvprabu10-Feb-13 19:02 
-- Multiple Update using Joins

-- Create temp table for Teste Update Statement
CREATE TABLE EmpDtls(Code VARCHAR(10), Name VARCHAR(100), DeptCode TINYINT)
CREATE TABLE DeptDtls(DeptCode TINYINT, DeptName VARCHAR(50), EmpCount INT)
 
-- Insert Sample Values
INSERT INTO EmpDtls(Code, Name, DeptCode)
VALUES('Emp1','Venkat', 1), ('Emp2','Prabu', 2), ('Emp3','Kumar', 1), ('Emp4','Karthick', 3),
('Emp5','Amith', 2),('Emp6','HariKrishna', 2)
 
INSERT INTO DeptDtls(DeptCode, DeptName)
VALUES(1, 'IT'),(2, 'Sales'), (3,'HR'), (4, 'Accounts')
 
-- Check the sample values
SELECT Code, Name, DeptCode FROM EmpDtls
SELECT DeptCode, DeptName,EmpCount FROM DeptDtls
 
-- Update Employees Count
UPDATE D SET D.EmpCount= E.EmpCount
FROM DeptDtls D
INNER JOIN (SELECT DeptCode, COUNT(Code) 'EmpCount' FROM EmpDtls GROUP BY DeptCode) E ON E.DeptCode=D.DeptCode
 
SELECT DeptCode, DeptName,EmpCount FROM DeptDtls
 
-- Drop Table 
IF OBJECT_ID('EmpDtls') IS NOT NULL DROP TABLE EmpDtls
IF OBJECT_ID('DeptDtls') IS NOT NULL DROP TABLE DeptDtls

AnswerRe: update values in a table in single query Pin
gvprabu20-Feb-13 22:43
membergvprabu20-Feb-13 22:43 
QuestionIs it possible to print a variable in stored procedure Pin
Deepthi.214567-Feb-13 20:45
memberDeepthi.214567-Feb-13 20:45 
AnswerRe: Is it possible to print a variable in stored procedure Pin
nainakarri7-Feb-13 21:22
membernainakarri7-Feb-13 21:22 
GeneralRe: Is it possible to print a variable in stored procedure Pin
vanikanc12-Feb-13 9:19
membervanikanc12-Feb-13 9:19 
QuestionVisual Studio 2005 Access 2010 Database Pin
Member 98194707-Feb-13 13:06
memberMember 98194707-Feb-13 13:06 
AnswerRe: Visual Studio 2005 Access 2010 Database Pin
Mycroft Holmes7-Feb-13 14:45
memberMycroft Holmes7-Feb-13 14:45 
QuestionSimulate transaction: non blocking insert / update Pin
Bob Stanneveld7-Feb-13 12:12
memberBob Stanneveld7-Feb-13 12:12 
AnswerRe: Simulate transaction: non blocking insert / update Pin
Mycroft Holmes7-Feb-13 14:44
memberMycroft Holmes7-Feb-13 14:44 
QuestionPropagating a MySQL transaction with MSMQ II Pin
Ger Hayden6-Feb-13 9:08
memberGer Hayden6-Feb-13 9:08 
QuestionMissing Data in an Access Report Pin
Vuyiswa Maseko6-Feb-13 4:03
memberVuyiswa Maseko6-Feb-13 4:03 
AnswerRe: Missing Data in an Access Report Pin
jschell6-Feb-13 9:11
memberjschell6-Feb-13 9:11 
GeneralRe: Missing Data in an Access Report Pin
Vuyiswa Maseko6-Feb-13 20:01
memberVuyiswa Maseko6-Feb-13 20:01 
GeneralRe: Missing Data in an Access Report Pin
jschell7-Feb-13 10:52
memberjschell7-Feb-13 10:52 
AnswerRe: Missing Data in an Access Report Pin
Mycroft Holmes6-Feb-13 13:27
memberMycroft Holmes6-Feb-13 13:27 
GeneralRe: Missing Data in an Access Report Pin
Vuyiswa Maseko6-Feb-13 20:06
memberVuyiswa Maseko6-Feb-13 20:06 
GeneralRe: Missing Data in an Access Report Pin
Mycroft Holmes6-Feb-13 21:27
memberMycroft Holmes6-Feb-13 21:27 
GeneralRe: Missing Data in an Access Report Pin
Vuyiswa Maseko6-Feb-13 21:32
memberVuyiswa Maseko6-Feb-13 21:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web01 | 2.8.161205.1 | Last Updated 2 Dec 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid