473,416 Members | 1,869 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,416 software developers and data experts.

Select statement for username and userid from a table & sort userid from another tabl

If I create a Select statement to select a username and userid from a table then I want to select the userid from another table and sort on the userid for example I sorted on the email usernames and userIDs, then I wanted to select the userids from another table and search for how many messages were sent from the user id in 1 day. Can I use the group function or is there a better what to search on this? If so, please tell me the best way to accomplish this.

Thanks!!
Sep 7 '10 #1
2 1569
Oralloy
988 Expert 512MB
Donna.

Conceptually I think you're looking for something like this?

Expand|Select|Wrap|Line Numbers
  1. SELECT t1.username, t1.userid, COUNT(t2.*), t2.date
  2.   FROM t1 INNER JOIN t2 ON t1.userid = t2.userid
  3.   ORDER BY t1.userid
  4.   GROUP BY t2.date
  5.  
Sep 8 '10 #2
The question needs a bit clarification. If the two tables are having the same structure and records are put on both tables you can use the union or union all operator that will put all the records from the two tables and then use the count function as count(*) or count(userid) that will give you the total number of abservation. The second option is as described by Donna join the tables and use the count function.
Alemayehu G. Desta
Dec 7 '11 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Zach | last post by:
------=_NextPart_000_00BB_01C35C12.E31BEA10 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I'm trying to use a select statement for a table that uses...
0
by: Rob Knowles | last post by:
I have created a script that runs once a week and copies data from one table (phpbb_users is the actual table name) in a database called users I have a table called users. There are two tables...
2
by: Edwinah63 | last post by:
Hi Everyone, All the very best for 2004!! i need urgent help with this problem, the users are about to skin me alive!! we have an access front end with linked to sql server 2k tables. ...
1
by: Ryan | last post by:
I've just inherited a system and have some concerns about the speed of connections to a remote server (SQL2000). If I do a simple select statement on the table below, it takes 14 minutes to retrive...
0
by: Mountain_Dewski | last post by:
Hi, I want to do a select statement in one table. The table has two columns: Citycode, TeamCode The citycodes may have multiple team codes, and the team code may be the same as the...
4
by: maricel | last post by:
Could someone confirm which tablespace is being used when running ALTER & CREATE INDEX. Is it the tempspace or the tablespace where the table resides? Many thanks, maricel
1
by: Angelos | last post by:
Hello, I have the folowing table: ----------- | content | ----------- |id | |parentId | |title | -----------
1
by: wugon.net | last post by:
Hi All, Any one know how to audit select statement on specify table for db2 LUW v8 or v9 ? have db2 tools or 3rd party tools can solve ? Thanks.
1
by: ncsthbell | last post by:
Once again... I am supporting another Access database that I did not build. The previous 'owner' of this built the tables with spaces in the table names as well as the column names. I am having a...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.