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.
Author |
Topic |
clawr687
Starting Member
2 Posts |
Posted - 2012-03-10 : 17:36:42
|
Hi there,I am trying to get only the distinct rows foe my query but I'm not too sure how to do that.The results I am getting are:147 92 22 1 1 1 1 1 Worker 1150 92 22 1 1 1 1 1 Worker 1147 93 25 1 45 62.50 90 110 Worker 1150 93 25 1 45 62.50 90 110 Worker 1140 94 25 2 40 60 80 110 Worker 2141 95 25 3 38 57 76 110 worker 3148 95 25 3 38 57 76 110 worker 3149 95 25 3 38 57 76 110 worker 3The results I want are:147 93 25 1 45 62.50 90 110 Worker 1150 93 25 1 45 62.50 90 110 Worker 1140 94 25 2 40 60 80 110 Worker 2141 95 25 3 38 57 76 110 worker 3148 95 25 3 38 57 76 110 worker 3149 95 25 3 38 57 76 110 worker 3Column 1 is tbl_lem.lem_IDThis is my Query:SELECT tbl_rate.rate_ID, tbl_rate.rate_site_IDref, tbl_rate.rate_rank_IDref, tbl_rate.rate_dollar, tbl_rate.rate_ot, tbl_rate.rate_dt, tbl_rate.rate_loa, tbl_employee.employee_name, tbl_LEM.LEM_date, tbl_LEM.LEM_reg_hrs, tbl_LEM.LEM_ot_hrs, tbl_LEM.LEM_dt_hrs, tbl_LEM.LEM_tt_hrs, tbl_LEM.site_IDREF, tbl_LEM.LEM_LOA, tbl_LEM.LEM_Expenseinfo, tbl_LEM.LEM_workorder, tbl_LEM.LEM_posted, tbl_LEM.LEM_Expense, tbl_LEM.LEM_tagnumberREF, tbl_LEM.LEM_reg_rate, tbl_LEM.Lem_ot_rate, tbl_LEM.Lem_tt_rate, tbl_LEM.LEM_dt_rate, tbl_LEM.Lem_loa_rate, tbl_LEM.LEM_ID, tbl_LEM.LEM_equip_daysFROM tbl_rate INNER JOIN tbl_employee ON tbl_rate.rate_rank_IDref = tbl_employee.employee_rankREF INNER JOIN tbl_LEM ON tbl_employee.employee_ID = tbl_LEM.employee_IDREFWHERE (tbl_LEM.site_IDREF = #FORM.site_ID#) AND (tbl_rate.rate_site_IDref= = #FORM.site_ID#)This line causes me grief AND (tbl_LEM.LEM_date = <cfqueryparam value="#FORM.LEM_date#" cfsqltype="cf_sql_timestamp">)The unique column that I need the results by is tbl_lem.lem_IDThanks in advance for your help |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-03-10 : 23:08:45
|
whats the rule which determines what row to be selected within a worker group? how do you determine the duplicate? please explain with some sample data------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|