Subject Re: [firebird-support] Re: help with a select, i m out of ideas.
Author Fabio Gomes
Anyway, sorry about all those newbie questions, but i have another one ^^

Now i need to make a report that shows all the clients that didnt buy
anything on that month.. so i tried this:

SELECT C.cli_nome
FROM clientes C, vendas V
WHERE (SELECT V.vnd_cod FROM vendas V, clientes C WHERE V.cli_cod=C.cli_cod)
IS NULL AND V.vnd_data BETWEEN '2006-1-01' AND '2006-1-31'

I dont really understand how subselects work so i just guessed it, and it
seens that i ve guessed it wrong, cause it didnt work.

Could you guys help me out with this too?

Thanx in advance.

On 3/30/06, Fabio Gomes <fabioxgn@...> wrote:
>
> Thanx guys this was really simple!
>
> Now my query is working fine and i can do the report with just one select
> :)
>
>
>
>
> On 3/29/06, Adam < s3057043@...> wrote:
> >
> > >
> > > SELECT FIRST 20 SUM(V.vnd_total) as TOTAL,
> > > (SELECT SUM(I.item_qtde) FROM items_venda I WHERE
> > I.vnd_cod=V.vnd_cod) AS
> > > QTDE,
> > > C.cli_nome FROM VENDAS V
> > > JOIN clientes C ON (C.cli_cod=V.cli_cod)
> > > WHERE V.vnd_data BETWEEN '2006-03-01' AND '2006-03-31'
> > > GROUP BY C.cli_nome, V.vnd_cod
> > > ORDER BY SUM(I.item_qtde) DESC
> > >
> > > Dynamic SQL Error SQL error code = -206 Column unknown I.ITEM_QTDE
> > At line
> > > 10, column 21.
> > >
> > > I tried ORDER BY QTDE, but it didnt work, is there any way to do this?
> >
> > Use the field position syntax for order by
> >
> > 'Order By [Field Position in select]'
> >
> > In this case,
> >
> > ORDER BY 2 DESC
> >
> > Adam
> >
> >
> >
> >
> >
> >
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >
> > Visit http://firebird.sourceforge.net and click the Resources item
> > on the main (top) menu. Try Knowledgebase and FAQ links !
> >
> > Also search the knowledgebases at http://www.ibphoenix.com
> >
> > ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >
> >
> >
> > ------------------------------
> > YAHOO! GROUPS LINKS
> >
> >
> > - Visit your group "firebird-support<http://groups.yahoo.com/group/firebird-support>"
> > on the web.
> >
> > - To unsubscribe from this group, send an email to:
> > firebird-support-unsubscribe@yahoogroups.com<firebird-support-unsubscribe@yahoogroups.com?subject=Unsubscribe>
> >
> > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > Service <http://docs.yahoo.com/info/terms/> .
> >
> >
> > ------------------------------
> >
>
>


[Non-text portions of this message have been removed]