List:General Discussion« Previous MessageNext Message »
From:Sebastian Mendel Date:March 10 2008 12:57pm
Subject:Re: Select Statement
View as plain text  
Velen schrieb:
> Hi,
> 
> I need to write up  a select statement something like:
> 
> Select a.supcode,a.code,b.desc,sum(c.qty),c.dept where 
> a.supcode=b.supcode and a.code=c.code and a.code=b.code and c.dept 
> between $tring1 and $tring2. group by supcode
> 
> This is fine but the problem is that there is duplicate supcode in a.
> 
> When running this query I often have c values which does not relate to 
> supcode.

yes, because c is JOINED by `code` and not by `subcode` with a "and 
a.code=c.code"


-- 
Sebastian
Thread
MYSQL FUNCTIONSKrishna Chandra Prajapati10 Mar
  • Select StatementVelen10 Mar
    • Re: Select StatementSebastian Mendel10 Mar
    • Re: Select StatementSebastian Mendel12 Mar
  • Re: MYSQL FUNCTIONSSebastian Mendel10 Mar
  • Re: MYSQL FUNCTIONSTim McDaniel10 Mar
Re: Select StatementVelen10 Mar
  • Re: Select StatementPeter Brawley10 Mar
    • Re: Select StatementBaron Schwartz10 Mar