table TABLE_NAME has key1 , key2 , key3 columns .
select key1,key2, key3 from TABLE_NAME group by key1, key2 , key3 having count(*)>1
Wednesday, June 23, 2010
Monday, June 7, 2010
Copy column from one table to other table
------------------------
EMPLOYEE TABLE
------------------------
salCodeid name
------------------------
---------------------------------------------
SALARY TABLE
----------------------------------------------
idsalCode salary basic tax bonus
---------------------------------------------
Column exists in target table then
INSERT INTO EMPLOYEE (salCodeid) SELECT idsalCode FROM SALARY
If column does not exixts
ALTER EMPLOYEE (salCodeid) SELECT idsalCode FROM SALARY
EMPLOYEE TABLE
------------------------
salCodeid name
------------------------
---------------------------------------------
SALARY TABLE
----------------------------------------------
idsalCode salary basic tax bonus
---------------------------------------------
Column exists in target table then
INSERT INTO EMPLOYEE (salCodeid) SELECT idsalCode FROM SALARY
If column does not exixts
ALTER EMPLOYEE (salCodeid) SELECT idsalCode FROM SALARY
Subscribe to:
Posts (Atom)