Click here to Skip to main content
15,895,084 members
Home / Discussions / Database
   

Database

 
GeneralRe: Attach SQL 2000 mdf on MSDE 2000 Pin
Hesham Amin25-May-04 23:55
Hesham Amin25-May-04 23:55 
GeneralRe: Attach SQL 2000 mdf on MSDE 2000 Pin
RichardGrimmer26-May-04 4:18
RichardGrimmer26-May-04 4:18 
GeneralNew Row with Id Pin
Anonymous25-May-04 4:15
Anonymous25-May-04 4:15 
GeneralRe: New Row with Id Pin
Michael Potter25-May-04 11:35
Michael Potter25-May-04 11:35 
GeneralProblem about MSDE installation Pin
wk_vigorous25-May-04 0:47
wk_vigorous25-May-04 0:47 
GeneralRe: Problem about MSDE installation Pin
RichardGrimmer26-May-04 4:23
RichardGrimmer26-May-04 4:23 
Generaloptimize this query Pin
varun8025-May-04 0:25
varun8025-May-04 0:25 
GeneralRe: optimize this query Pin
Grimolfr25-May-04 3:31
Grimolfr25-May-04 3:31 
Do you have any indexes or a primary key on table1?

If you do, do any of them have account_id as the first (or only) column in the index?

Finally, try this and see what it gets you:
SELECT DISTINCT
    A.account_id
FROM
    table1 A
    LEFT OUTER JOIN table2 B
        ON B.account_id = A.account_id
WHERE
    B.account_id IS NULL


This assumes that account_id is a primary key or other non-nullable column in table2.

There are many ways this query could be written to achieve the same results, but the question as to which ones would actually work, and which one would be most efficient requires much more information than what you've provided.


Grim
(aka Toby)
MCDBA, MCSD, MCP+SB

GeneralRe: optimize this query Pin
varun8025-May-04 19:34
varun8025-May-04 19:34 
GeneralRe: optimize this query Pin
Grimolfr26-May-04 4:42
Grimolfr26-May-04 4:42 
Generalquery inside a dataset Pin
fuel2run24-May-04 21:27
fuel2run24-May-04 21:27 
GeneralRe: query inside a dataset Pin
ekolis25-May-04 9:02
ekolis25-May-04 9:02 
GeneralRe: query inside a dataset Pin
fuel2run25-May-04 21:08
fuel2run25-May-04 21:08 
GeneralRe: query inside a dataset Pin
ekolis26-May-04 10:58
ekolis26-May-04 10:58 
GeneralRe: query inside a dataset Pin
fuel2run27-May-04 4:34
fuel2run27-May-04 4:34 
GeneralRe: query inside a dataset Pin
ekolis27-May-04 10:53
ekolis27-May-04 10:53 
GeneralRe: query inside a dataset Pin
fuel2run27-May-04 21:04
fuel2run27-May-04 21:04 
GeneralRe: query inside a dataset Pin
ekolis28-May-04 9:28
ekolis28-May-04 9:28 
GeneralRe: query inside a dataset Pin
fuel2run29-May-04 2:55
fuel2run29-May-04 2:55 
GeneralRe: query inside a dataset Pin
ekolis29-May-04 9:15
ekolis29-May-04 9:15 
GeneralRe: query inside a dataset Pin
fuel2run29-May-04 22:14
fuel2run29-May-04 22:14 
GeneralRe: query inside a dataset Pin
ekolis30-May-04 15:50
ekolis30-May-04 15:50 
GeneralRe: query inside a dataset Pin
fuel2run30-May-04 23:55
fuel2run30-May-04 23:55 
GeneralRe: query inside a dataset Pin
ekolis31-May-04 13:54
ekolis31-May-04 13:54 
GeneralRe: query inside a dataset Pin
fuel2run31-May-04 22:02
fuel2run31-May-04 22:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.