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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Recent content by JazzMaan

  1. JazzMaan

    Conversion failed when converting the varchar value ' <> 0 then ' to data type int.

    Solution is: Use If then for comparison By design as i Understand you can not do a comparison using CASE with two variables. I ended up doing something like: Set @count1 = (select....) Set @count 2 = (select count(*) from....) If @count1 = @count 2 ..... Else .....
  2. JazzMaan

    Conversion failed when converting the varchar value ' <> 0 then ' to data type int.

    I am trying to run below and get this error even though the columns is a integer.??? CAST(@CAMPCOUNT AS INTEGER) IS THE Issue in below query: DECLARE @CAMPCOUNT INTEGER,... SET @SQLinsert = 'INSERT INTO ' + @DBName + 'WAVE_QC_HISTORY (Exec_ID, Test_Number, Test_Name, Test_Result...
  3. JazzMaan

    Date Calculation help

    Startdate = starting day of week - Sunday Enddate = end of week so Saturday still testing/checking i think i need - WHEN 0 THEN Convert(date,getdate()-6)
  4. JazzMaan

    Date Calculation help

    so i came up with below that works but thats a lot of code - is this efficent or any better way? SELECT StartDate = CASE (DATEPART(dw, GETDATE()) + @@DATEFIRST) %7 WHEN 1 THEN Convert(date,getdate()-7) WHEN 2 THEN Convert(date,getdate()-8) WHEN 3 THEN Convert(date,getdate()-9) WHEN 4 THEN...
  5. JazzMaan

    Date Calculation help

    i would like to select date from a table where the transaction happened in last week (sunday through saturday) What can i use to day to find out last week Sunday and saturday given running the query today. thanks
  6. JazzMaan

    Group by question

    Thanks JarlH with your help i solved it in this way: select trans_id from ( select a.member_id, max(b.trans_id)as trans_unique_id from table1 b join table2 a on a.trans_id = b.trans_id group by a.member_id )d
  7. JazzMaan

    Group by question

    Table 1 (transaction table) key - tran_id - unique id for this table. Columns: tran_id member_id Table 2 (member table) Columns: member_id Every time a member does a transcation like deposit, its saved in transaction table. data-table 1: tran_id, member_id 1,1 2,1 3,1 4,1 5,2 6,2...
  8. JazzMaan

    Group by question

    Distinct wont work me as: -all tran_id are allready distinct -what is common between them is the member id so what i really need is a single record for a given member anyother way to do it?
  9. JazzMaan

    Group by question

    I have 2 tables: Table 1: only had TranId - 4 transaction records Table 2: TranId, Member Id - - 4 transaction records for same member in table 1 I would like to pick a transaction record group by the member id. Please help me with query. I have tried below - but putting the transaction id in...
  10. JazzMaan

    Query Help

    i have 2 tables: Individual: has iid, hid (Individual id, household id) Order_header: iid, order amount I want the query to return 1 individual per household who has the hightest order amoount
  11. JazzMaan

    dinstinct with multiple columns

    I am sorry, could you provide the query blog is working with 2 tables, In my case I only have one table.
  12. JazzMaan

    dinstinct with multiple columns

    What if i dont have a last updated column. Seems like this is a case of bad data. How can i write a query to randomly pick one of many records for a given sku?
  13. JazzMaan

    dinstinct with multiple columns

    i need distinct part and rest of the fields, how do i do it? select part, desc, qty... from partstable i cant do select distinct part, desc, qty... from partstable as I only need one of records in case the part# is repeated
  14. JazzMaan

    getting value of radio button on submit

    getting null value error
  15. JazzMaan

    getting value of radio button on submit

    i have a set with radio buttons. on submit i need to check if one of them is selected then redirect to a page. following code is giving error: <form name="q1" method="post" > <h4>Please answer the following questions:</h4> 1.What is your Education qualifaction?<br> <input type="radio"...

Part and Inventory Search

Back
Top