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 Mike Lewis 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: *

  • Users: kbsc
  • Order by date
  1. kbsc

    Upper and Lower Case

    Thanks for your help but the http://vyaskn.tripod.com/code/propercase.txt will not work for what I'm trying to do. I can't use a function. I can only use a select query that will manipulate the data.
  2. kbsc

    Upper and Lower Case

    I've looked through the links everyone put up and the posts don't match what I need to do. I am changing the value on the front end by using a merge field. But I have to write a select query that will change the data and then when the user pulls the report the data will display correctly. Our...
  3. kbsc

    Upper and Lower Case

    I'm trying to create a query that will display our database field with Upper and Lower case (currently the data is saved as all Upper case). So for vchBusinessName = ARROW PLUMBING AND SERVICES, INC. I want it to display = Arrow Plumbing And Services, Inc. I've created this query: SELECT...
  4. kbsc

    Insert statement

    It worked perfectly thanks!
  5. kbsc

    Insert statement

    I have not created many insert statements and I'm not sure how this one should be coded. Please help. I need to insert a record based on a select query that will give me a record set of what needs to be inserted. select query will give me intCaseID from tblCase. 12345 23456 34567 Then I...
  6. kbsc

    UPDATE with MAX

    Ok I've revised my UPDATE query, any input would be really great: UPDATE tblBankAccount SET bank.dteClosed = maxDate.DateClosed ,bank.intDontPostInterest = 1 ,bank.vchEditedBy = autoBAClose ,bank.dteEdited = GetDate() FROM tblBankAccount bank INNER JOIN ( SELECT C.vchCaseNumber...
  7. kbsc

    UPDATE with MAX

    I have a Select Query that I have tested and is pulling the results I want, now I need to create an UPDATE statement and I'm not sure how to with a MAX involved in the update. Please help!! I'm not familiar with writing UPDATE stmts. Thanks in advance. SELECT STATEMENT SELECT...
  8. kbsc

    TOP 9 summed value + (A Total Sum value - Top 9 value)

    Thank you so much! I have so many subqueries already, not sure why I didn't think to do one more. Thanks again!
  9. kbsc

    TOP 9 summed value + (A Total Sum value - Top 9 value)

    I need help I have a very long query. That I know could be written better and more efficient but, I'm not sure how. The query works except for in the First Select Stmt, it wont let me include the ORDER BY (I put *** by it). Someone suggested for me to user the feature of CUBE, but I have to...
  10. kbsc

    Combining two queries and make results join into one column

    I've created a very long and complicated Derived Query in order to Combine Two Queries and but my problem is its not giving me the correct results. My extremely long query is below, but here are my results and then I'll show you what I need it to do. Thanks in advance for any help! First of...
  11. kbsc

    CASE statement help with multiple tables

    You're right the 1/1/1900 is a default in our system that the field doesn't have a date value set. The null value thats returned will act as the same for me in this situation. Thanks for explaining about why you used the Left Join instead of Inner Join. Hopefully I'll be able to use this...
  12. kbsc

    CASE statement help with multiple tables

    Your code works perfect. I'll have to troubleshoot it with every scenario, but it looks like exactly what I need. I think I follow the logic, I just didn't know that could be done. The select COALESCE part is naming the two values i want pulled (first column dist.dtePosted if not null it'll...
  13. kbsc

    CASE statement help with multiple tables

    I forgot to mention its very important that only one date value is produced. This query can't have multiple values as a result.
  14. kbsc

    CASE statement help with multiple tables

    OK first this query needs to be runned and produce a value if there is a record in tblDistribution that meets the parameters. SELECT TOP 1(d.dtePosted) FROM tblDistribution d WHERE d.intDELETED = 0 AND d.intPosted = 1 AND d.intCaseID = @intCaseID If there was not a record in tblDistribution...
  15. kbsc

    CASE statement help with multiple tables

    Ok For lets say b.intCaseID = 1 in tblDistribution there's a row that meets the criteria of intDeleted = 0 and intPosted = 1, so it should pull the tblDistribution.dtePosted value of 1/1/2007 For lets say b.intCaseID = 2 in tblDistribution there are no rows for intCaseID = 2. So I want the...
  16. kbsc

    CASE statement help with multiple tables

    I rewrote it another way and I'm still getting the same results as the one above. ANY suggestions PLEASE!! SELECT TOP 1 (CASE when d.intCaseID is null then (SELECT MAX(t.dteTransaction) FROM tblTransaction t INNER JOIN tblBankAccount b ON b.intAccountID = t.intAccountID GROUP BY...
  17. kbsc

    CASE statement help with multiple tables

    I did learn something, but I still can't get my query to work. I think its the multiple joins. The COALESCE could work but its only functioning like my original query. It will pull a value when d.dtePosted is not null, which is correct, BUT its not pulling a value when d.dtePosted is NULL and...
  18. kbsc

    CASE statement help with multiple tables

    NEED SOME HELP!! I've created the query below. I need a query that will look in a table and if intCaseID is null, then will pull a date in another table, else will pull a date in that table. Right now it only works one way if the value is not null, it works correctly. If its null, then it...
  19. kbsc

    Need to user query results for another query

    You're right the Count statement in the SELECT clause is what caused alot of my problems. I rewrote it to this and it did what I needed. Thanks for everyones advice: SELECT ba.intAccountID, c.vchTrustee, c.vchCaseNumber, ba.vchAccountNumber, c.intStatus FROM tblBankAccount ba INNER JOIN...
  20. kbsc

    Need to user query results for another query

    I've created the below query but I get an error of : Server: Msg 245, Level 16, State 1, Line 1 Syntax error converting the varchar value '562-223' to a column of data type int. Server: Msg 248, Level 16, State 1, Line 1 The conversion of the varchar value '312602821065' overflowed an int...

Part and Inventory Search

Back
Top