Re: counting records in 2 tables using 1 query

2005-01-14 Thread SGreen
OK, then you were on the right track with your JOINS because you wanted to know how many of each type of item (gift or event) each user had. Off the top of my head, I think you need to perform an OUTER JOIN (not the implicit INNER JOIN you create by listing table names separated by commas) and

Re: counting records in 2 tables using 1 query

2005-01-14 Thread 2wsxdr5
[EMAIL PROTECTED] wrote: There may be other ways to get at the information you want. What is the purpose of your query? Ok here are the details. I have a wish list/gift registry site (thewishzone.com). I have a table listing all the data on my users. I also have a table listing all the gifts

Re: counting records in 2 tables using 1 query

2005-01-13 Thread SGreen
There may be other ways to get at the information you want. What is the purpose of your query? Shawn Green Database Administrator Unimin Corporation - Spruce Pine 2wsxdr5 <[EMAIL PROTECTED]> wrote on 01/13/2005 01:57:31 PM: > I have these 2 queries. > > SELECT count(*) gifts > FROM gift g

Re: counting records in 2 tables using 1 query

2005-01-13 Thread Peter Brawley
How about ... select @a:=count(*) from ... where ... union select @b:=count(*) from ... where ... union select @[EMAIL PROTECTED]; PB --- 2wsxdr5 wrote: I have these 2 queries. SELECT count(*) gifts FROM gift g WHERE g.this and g.that SELECT count(*) events FROM events e WHERE e.this and e.the

counting records in 2 tables using 1 query

2005-01-13 Thread 2wsxdr5
I have these 2 queries. SELECT count(*) gifts FROM gift g WHERE g.this and g.that SELECT count(*) events FROM events e WHERE e.this and e.the other thing is there a way to put these into one query. SELECT count(g.*) gifts, count(e.*) FROM gift g, event e WHERE . . . . so far nothing seems t