Re: Why doesn't this work?
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 06/18/04
- Next message: Adam Machanic: "Re: Create view limitation"
- Previous message: Miguel Dias Moura: "Really need to solve this SQL problem to finish this web site."
- In reply to: D Mack: "Why doesn't this work?"
- Next in thread: D Mack: "Re: Why doesn't this work?"
- Reply: D Mack: "Re: Why doesn't this work?"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 18 Jun 2004 23:10:30 +0200
On Fri, 18 Jun 2004 13:47:01 -0700, D Mack wrote:
>Can anyone give me a clue? Please! The first part, before the and, works perfectly, but the remainder does not return the appropriate rows.
>
>select shop_person from ae_p_wka_e where
>(convert(char(10), ae_p_wka_e.sched_date, 101)) = (convert(char(10), getdate() - 2, 101)) and ae_p_wka_e.shop_person not in
>(select shop_person from ae_l_shp_d where ae_l_shp_d.shop_person = ae_p_wka_e.shop_person)
>
>Thanks.
Hi D,
The subquery finds all shop_persons in ae_l_shp_d (awful table names, by
the way) that are EQUAL to the shop_person in ae_p_wka_e; the not in then
says that no shop_person from this subquery may be equal - of course, this
will exclude any row.
Why don't you explain what you want to achieve. Begin by posting your DDL
(CREATE TABLE statements, including constraints), so we get to know what
your tables look like. Explain your business need; include illustrative
sample data (as INSERT statements, so we can cut and paste it onto our
databases for testing) and expected output.
Without DDL and sample data, with only a query and a "it does not work!",
we have precious little to go on!
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: Adam Machanic: "Re: Create view limitation"
- Previous message: Miguel Dias Moura: "Really need to solve this SQL problem to finish this web site."
- In reply to: D Mack: "Why doesn't this work?"
- Next in thread: D Mack: "Re: Why doesn't this work?"
- Reply: D Mack: "Re: Why doesn't this work?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|