Author |
Topic |
kevinxyx
Starting Member
11 Posts |
Posted - 2011-08-23 : 00:34:11
|
how to display multiple tables from my time keeping tableexample.<table>EmpID 111111</table><table>EmpID222222</table><table>EmpID3333333 </table> |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 00:38:07
|
sorry your question is not clear please elaborate on what you mean bymultiple tables from my time keeping table------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
kevinxyx
Starting Member
11 Posts |
Posted - 2011-08-23 : 01:39:50
|
sorry what i mean is, how to display my timekeeping table in separate tables by its empidexample timekeeping table, fieldsempid date timein time out1 7/22/2011 8:30AM 12:00PM1 7/23/2011 9:00AM 1:00PM2 7/24/2011 12:00PM 3:00PM2 7/25/2011 1:00PM 3:00PM3 7/26/2011 9:00AM 12:00PM3 7/26/2011 1:00PM 3:00PMso it will be like this<table>empid date timein time out1 7/22/2011 8:30AM 12:00PM1 7/23/2011 9:00AM 1:00PM</table><table>empid date timein time out2 7/24/2011 12:00PM 3:00PM2 7/25/2011 1:00PM 3:00PM</table><table>empid date timein time out3 7/26/2011 9:00AM 12:00PM3 7/26/2011 1:00PM 3:00PM</table> |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 02:05:22
|
thats easier do likeinsert into table1select * from timekeeping where empid=1insert into table2select * from timekeeping where empid=2....------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
kevinxyx
Starting Member
11 Posts |
Posted - 2011-08-23 : 04:14:12
|
thanks visakh, i need to inner join 3 tablesSELECT a.EmpID, a.FirstName, a.MiddleName, a.LastName, b.College_Name, C.Dept_NameFROM Employee a INNER JOIN College b INNER JOIN PLP_DEPARTMENT C ON a.RECID = b.COLLEGE ON a.RECID = b.DEPT_NAMEgetting error "column prefix 'a' does not match with a table name" |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 04:26:06
|
try thisSELECT a.EmpID, a.FirstName, a.MiddleName, a.LastName, b.College_Name, C.Dept_NameFROM Employee a INNER JOINCollege b ON a.RECID = b.COLLEGE INNER JOINPLP_DEPARTMENT C ON a. c.RECID = b.DEPT_NAME ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
kevinxyx
Starting Member
11 Posts |
Posted - 2011-08-23 : 05:20:53
|
woah thanks again visahk, i have another problemi want to delete the time in and time out where DLOG = 1, making it like this, marking the deleted to absentcan it be done? with delete statement |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 05:27:38
|
sorry didnt get that. Whats DLOG? I cant see that column in your sample.Also do you have any column which determines whether emp is absent?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
kevinxyx
Starting Member
11 Posts |
Posted - 2011-08-23 : 05:45:44
|
dlog is on the last column |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 07:10:34
|
i think what you're asking is thisDELETE FROM timekeeping WHERE DLOG=1 first put select and see if it returns required records and then do deletei didnt understand belowmarking the deleted to absentdo you mean adding deleted details to another table?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
kevinxyx
Starting Member
11 Posts |
Posted - 2011-08-23 : 09:46:55
|
do you mean adding deleted details to another table?yes and marking them as absent |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 13:14:23
|
quote: Originally posted by kevinxyx woah thanks again visahk, i have another problemi want to delete the time in and time out where DLOG = 1, making it like this, marking the deleted to absentcan it be done? with delete statement
for this what you need is updateUPDATE timekeeping SET TimeIn='Absent',timeOut='Absent'WHERE DLOG=1 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-08-23 : 13:15:24
|
quote: Originally posted by kevinxyx do you mean adding deleted details to another table?yes and marking them as absent
for this you need a trigger if you're using sql 2000. if on or above sql 2005 you can use new OUTPUT clause------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|