Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. WaveOut

    I have a view that returns the foll

    Thanks! That worked perfect! David
  2. WaveOut

    I have a view that returns the foll

    I have a view that returns the following: select * from latest_report projectname contractor_name date Barry O&M Vulcan 01/01/2007 Barry O&M Vulcan 02/01/2007 Barry O&M Vulcan...
  3. WaveOut

    Stored Procedure to duplicate record(s)

    I think I figured it out. The craft_count was a required field. I removed that constrant and it now works. Dave
  4. WaveOut

    Stored Procedure to duplicate record(s)

    I have tried the following but it did not work: CREATE PROCEDURE spDupeWeek -- @wuid = current week we are working with -- @wuid_copy = week we want to copy data from @wuid uniqueidentifier, @wuid_copy uniqueidentifier AS BEGIN Insert Into Craft(week_Uid,craft_ID,craft_group...
  5. WaveOut

    Stored Procedure to duplicate record(s)

    I would like to duplicate some records in a table. The table name is Craft and it has the following fields: id - integer (Identity = Yes) week_UID - uniqueidentifier craft_ID - integer craft_group - integer craft_name - nvarchar craft_category - nvarchar craft_count - integer...
  6. WaveOut

    Sum count by day then return max

    Thanks again for the help ... Here is the actual code I have so far ( I know it's alot diffrent from my initial post but I was trying to keep if simple) SELECT top 100 percent end_date, craft_category, craft_name, day_of_week, day_count, night_count, max(subtotal) AS max_count_week...
  7. WaveOut

    Sum count by day then return max

    Thanks for the reply. I think your code is very close to what I need, however I will need to be stepping through many weeks and I need the maximum for each week. Dave
  8. WaveOut

    Sum count by day then return max

    Hello, I have the following data: Craftname day_of_week count Craft 1 Monday 2 Craft 2 Monday 8 Craft 3 Monday 3 Craft 4 Monday 5 Craft 1 Tuesday 1 Craft 2 Tuesday 4 Craft 3 Tuesday 1 Craft 4...
  9. WaveOut

    Lookup data in one table and move to another

    RiverGuy, Thanks! works great! Dave
  10. WaveOut

    Lookup data in one table and move to another

    I need help with the following: I have two tables. The first table, Craft_temp, contains the following fields: craftID craft_group craft_name craft_cateogry 1 1 Carpenter A Carpenter 2 2 Carpenter B Carpenter 3...
  11. WaveOut

    sql calculations

    OK I was able to get the function to work! SQLSister, thanks again for the suggestion to use a function to get the results I needed. Thanks for everyone's help. Dave
  12. WaveOut

    sql calculations

    SQLSister, Thanks for the suggestion on creating the User Defined Function. I think this is the way I want to go. I've created the following function: CREATE FUNCTION dbo.ratio (@weekid varchar(75), @category varchar(50)) RETURNS decimal AS BEGIN Declare @TotalHours decimal Declare...
  13. WaveOut

    sql calculations

    Yes I have a table that contains all possible crafts. What I'm trying to do is create a report on the data you see above and I need to calculate the ratio of Apprentice to Journeyman. Dave
  14. WaveOut

    sql calculations

    Thanks for the tip on the float data type, I made the changes. What I'm trying to do is calculate the ratio of Journeymen to Apprentice. The above stored procedure works nicely but for only the craft type that is passed in via the @category parameter. Here's what the data looks like: craft...
  15. WaveOut

    sql calculations

    Let me try to simplify this some. I use the above sql code to return data from a table. Now what I would like to do is on each row that is returned I would like to run the following stored procedure: CREATE PROCEDURE spCalcRatio @weekid varchar(75),@category varchar(25) AS BEGIN...
  16. WaveOut

    sql calculations

    Thanks to everyone that responded. I was able to use the code that gmmastros provide. However I need to incorporate the ratio calculation into the following sql: SELECT Project_1.ProjectName, Project_1.OpCo, Project_1.Plant, Project_1.StartDate, Project_1.EndDate...
  17. WaveOut

    sql calculations

    I need to sum several fields then take product and use it in another calculation. For example: select sum(day_hrs)+sum(night_hrs)+sum(day_ot_hrs)+sum(night_ot_hrs) as total_hrs from Craft where weeklyuid = @weekid and craft_category = 'Boilermaker' select...
  18. WaveOut

    Help with math forumla within sql statement

    I need to calculate the following formula within an sql statement: --Tsat = Ax + B/x + C(x^0.5) + D(ln(x)) + E(x^2) + F(x^3) + G My first attempt is like so: Local a real; Local b real; Local c real; Local d real; Local e real; Local f real; Local g real; Local Tsat real; Local P real; a =...
  19. WaveOut

    Join two select statements

    I was able to figure it out. SELECT Tbl1.Ts, Tbl1.Max AS Skin1Max, Tbl2.Max AS Skin2Max, Tbl2.Max+Tbl1.Max as SkinSum FROM (SELECT ts,max,sum FROM aggregates WHERE name = '3B-HP-DRM-SKIN-1-T' AND ts between '14-JUN-06 07:32' AND '14-JUN-06 22:26') Tbl1 INNER JOIN (SELECT ts,max,sum FROM...
  20. WaveOut

    Join two select statements

    Thanks for the help with the code. Im using the following: SELECT Tbl1.Ts, Tbl1.Max AS Skin1Max, Tbl2.Max AS Skin2Max FROM (SELECT ts,max FROM aggregates WHERE name like '3B-HP-DRM-SKIN-1-T' AND ts between '14-JUN-06 08:32' AND '14-JUN-06 22:26') Tbl1 INNER JOIN (SELECT ts,max FROM...

Part and Inventory Search

Back
Top