V4RB Where condition in join query
Sims, John (CDC/CCHP/NCBDDD) (CTR)
ayu8 at cdc.gov
Thu Jun 5 13:02:02 CDT 2008
> -----Original Message-----
> From: valentina-bounces at lists.macserve.net
> [mailto:valentina-bounces at lists.macserve.net] On Behalf Of Erne
> Sent: Thursday, June 05, 2008 1:11 PM
> To: Valentina Valentina Developers
> Subject: V4RB Where condition in join query
>
> Hi Ruslan,
>
> I got this query:
>
> Select m.Recid as [m_Recid], m.Media_Description,
> m.Euro_Price, m.Stock, m.Edition_Date, a.Artist, b.Title,
> b.Recorded, m.Media, m.Items_in_Box, m.Filed_Date, m.Barcode
> From [Media] m Inner Join [Alb_Med_Linker] bmk On
> Alb_Med_Linker_Med_link Inner Join [Albums] b On
> Alb_Med_Linker_Alb_link Inner Join [Art_Alb_Linker] abk On
> Art_Alb_Linker_Alb_link Inner Join [Artists] a On
> Art_Alb_Linker_Art_link
> Where False
>
> that returns more than 70000 records...
> shouldn't it retun 0 records since Where condition is false?
>
>
> Cool Runnings,
> Erne.
>
> p.s.
> just curious, since this query is generated by mistake and I
> got to fix it on 1 table only I need it for an add cursor
Hi Erne,
I don't think "Where" is valid inside of a join condition. It should
probably be "And".
Something like...
Inner Join [Artists] a On (Art_Alb_Linker_Art_link AND [Some
condition]=False)
Your query is basically the equivalent of...
SELECT [fields]
FROM [tables]
WHERE False
Depending on the database, I'm not sure what that would give you. My
guess is either nothing or everything. I suspect you are getting
everything.
HTH
-John
More information about the Valentina
mailing list