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 TouchToneTommy 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 brettgab

  1. brettgab

    Darn query causing me grief

    I have two tables, an I'm trying to list all the items from I_ToDecide.stock_code which do not have a corresponding value in I_Stock_Colours.colour_stock_code. When I do a query using IN (SELECT...), the correct results are retured, but when I do a NOT IN (SELECT...), no values are returned...
  2. brettgab

    Select query help

    I have a table from which I need to select all records with a 'matching pair of fields'. For example my table contains the following structure, and the fields I'm matching are FIELD1 and FIELD3 ID FIELD1 FIELD2 FIELD3 1 Bob Ted Reg 2 Bob Peter 3 Bob...
  3. brettgab

    SQL Update Help Needed

    Terry you rock
  4. brettgab

    SQL Update Help Needed

    I have two tables, Merged_Stock and I_Products. I_Products has a field 'stock_code'. Merged_Stock has two fields, 'old_stock_code' and 'new_stock_code'. I want to write a query which updates I_Products.stock_code with Merged_Stock.new_stock_code. Records will be matched on I_Products.stock_code...
  5. brettgab

    Can't get Query Syntax right.....

    I'm trying to run a query which returns three fields, one of the fields needs any potential leading space stripped off. Due to my being a bit SQL-retarded, I can't get it working. Any help appreciated... SELECT DISTINCT kpp.plan_phone_code + kpp.plan_phone_suffix AS Plan_Code...
  6. brettgab

    Can't get query syntax right....

    Thanks Tim for you efforts, however this is not what I want. The query is simply a 'select' query returning (ultimately) a recordset to display. No updating is done as such, I still want the Territory_Code to remain the way it is on file, but I want the query to return a different value (as...
  7. brettgab

    Can't get query syntax right....

    There are two problems with the query below... 1. I'm trying to populate the field 'Territory_Code' with '900' if the Conn.Rep_Code exists in Table CCR, and populate it with the Conn.Territory_Code if it doesn't. I've got the first part working (populating certain records with '900') but you're...
  8. brettgab

    Can't get correct results with JOIN

    Here is my problem.... There is a view which displays connection profit amounts for stores. View CONN_PROFIT DATE STORE_ID CONN_PROFIT 01-Sep-2001 603 56.00 01-Sep-2001 603 144.00 01-Sep-2001 603 500.00 01-Sep-2001 604 200.00 01-Sep-2001 605...
  9. brettgab

    Query Performance is poor

    Terry, You are certainly a wealth of knowledge on SQL, how long have you been doing it for ? Thanks for your suggestions. I have done what you said points 2,3,4 and 5. Point 6....I've tried creating a storod procedure. When I run this query (with no stored procedure), it takes around 40...
  10. brettgab

    Query Performance is poor

    Thanks tapks OK, so you mention creating indices, there are about four fields that this query can be sorted on. Given this query is a query over a view, what do I do ? Do I need to create nonclustered indices for the tables I'm querying, or do I create seperate views with different order by...
  11. brettgab

    Query Performance is poor

    Greetings all (esp Terry !), OK I'm quite new to SQL Server and Transact-SQL and know very little about getting the best performance. I'm programming for a company and I have a massive query...Here it is... SELECT S.sys_description AS STORE, V.Territory_Code, (IsNull(Sum(V.Conn_Profit),0) +...
  12. brettgab

    SQL Server was renamed - can't use replication

    Terry, you are certainly a fountain of knowledge !!! Our website is being hosted by an ISP, Telstra (THE major Australian telecomms company). Therefore I don't think that we are able to replicate data between our servers, it's not allowed. We ARE allowed to schedule jobs however, so this brings...
  13. brettgab

    SQL Server was renamed - can't use replication

    Hello, I am VERY new to managing a SQL server database, although I'm an ASP programmer, all I've done is basically connected to one using ODBC. Any advice will have to be written as though you are talking to a complete novice. I am currently setting up a website (hosted elsewhere) which will...

Part and Inventory Search

Back
Top