> Don't you think you should use > > select * from test WHERE a=0 ; > > not > > select * from test where 0; > > Isn't the correct usage of WHERE
Well, usually my queries could look like this: insert into #report (Line) select isnull(a.Object, '') + char(9) + isnull(c.ClusterId, '***no cluster***') + char(9) + isnull(convert(varchar,c.Build), '') + char(9) + isnull(c.Gene, '') + char(9) + isnull(rg.AccNr, '') + char(9) + isnull(convert(varchar,rg.Plate), ' ***no clone***') + char(9) + case isnull(rg.Row, 0) when 0 then '' else char(rg.Row+64) end + char(9) + isnull(convert(varchar, rg.Col ), '') + char(9) + isnull(c.Title, '') + '<br>' from " + @TableName + " a(nolock) left join luCLusterData c(nolock) on c.AccNr = a.Object and c.Build = (select max(o.Build) from luOrganism o(nolock) where pkOrganism = c.Organism and o.Loaded = 1 and o.Locked = 0) left join luResGenClones rg on exists ( select * from luClusterData cd(nolock) where cd.ClusterID = c.ClusterID and rg.AccNr = cd.AccNr and cd.Build = (select max(o.Build) from luOrganism o(nolock) where pkOrganism = cd.Organism and o.Loaded = 1 and o.Locked = 0)) and Library = '" + @Library + "' group by a.Object, c.ClusterId, c.Build, c.Gene, rg.AccNr, rg.Plate, rg.Row, rg.Col, c.Title order by a.Object" Lest say I slip with my fingers or some ignorant users comes and disturbs me with some question, then this query might turn out like this instead; insert into #report (Line) select isnull(a.Object, '') + char(9) + isnull(c.ClusterId, '***no cluster***') + char(9) + isnull(convert(varchar,c.Build), '') + char(9) + isnull(c.Gene, '') + char(9) + isnull(rg.AccNr, '') + char(9) + isnull(convert(varchar,rg.Plate), ' ***no clone***') + char(9) + case isnull(rg.Row, 0) when 0 then '' else char(rg.Row+64) end + char(9) + isnull(convert(varchar, rg.Col ), '') + char(9) + isnull(c.Title, '') + '<br>' from " + @TableName + " a(nolock) left join luCLusterData c(nolock) on c.AccNr = a.Object and c.Build = (select max(o.Build) from luOrganism o(nolock) where pkOrganism and o.Loaded = 1 and o.Locked = 0) left join luResGenClones rg on exists ( select * from luClusterData cd(nolock) where cd.CLusterID = c.ClusterID and rg.AccNr = cd.AccNr and cd.Build = (select max(o.Build) from luOrganism o(nolock) where pkOrganism = cd.Organism and o.Loaded = 1 and o.Locked = 0)) and Library = '" + @Library + "' group by a.Object, c.ClusterId, c.Build, c.Gene, rg.AccNr, rg.Plate, rg.Row, rg.Col, c.Title order by a.Object Do you see the difference? Maybe. Maybe not. But it is this "maybe not" that scares me. Because If I miss that one, it means that the query will display every thing in an up-side down manner. And my hair will grow further gray... In Transaction-SQL this second query will generate an error if I tries to run it, but in MySQL it will run perfectly fine and do the opposite to what I wants to happen. --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php