473,563 Members | 2,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem counting rows in two tables

66 New Member
hey, this is what ive got so far:

Expand|Select|Wrap|Line Numbers
  1. ("SELECT (Select count(*) from tbl_flight_details) + (select count(*) FROM tbl_flight_departures) as grandtotal")
  2.  
i need to count all the records in the above 2 tables, following this query i need to count all the records depending on a certaion value... at the moment ive got them counting from just one table which is fine.

Expand|Select|Wrap|Line Numbers
  1.  rs6=cn.execute ("Select count(*) as cardiffdeparts from tbl_flight_departures WHERE departing_airport ='cardiff'") 
  2.  
  3.  
Mar 11 '08 #1
1 1630
amitpatel66
2,367 Recognized Expert Top Contributor
hey, this is what ive got so far:

Expand|Select|Wrap|Line Numbers
  1. ("SELECT (Select count(*) from tbl_flight_details) + (select count(*) FROM tbl_flight_departures) as grandtotal")
  2.  
i need to count all the records in the above 2 tables, following this query i need to count all the records depending on a certaion value... at the moment ive got them counting from just one table which is fine.

Expand|Select|Wrap|Line Numbers
  1.  rs6=cn.execute ("Select count(*) as cardiffdeparts from tbl_flight_departures WHERE departing_airport ='cardiff'") 
  2.  
  3.  
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT SUM(CNT) grandtotal FROM (Select count(*) AS CNT from tbl_flight_details UNION ALL select count(*) FROM tbl_flight_departures)
  3.  
  4.  
Mar 11 '08 #2

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

Similar topics

3
3035
by: Viswanatha Thalakola | last post by:
Hello, Can someone point me to getting the total number of inserts and updates on a table over a period of time? I just want to measure the insert and update activity on the tables. Thanks. - Vish
3
3145
by: Alex Ayzin | last post by:
Hi, I have a problem that might be easy to solve(possibly, I've just overlooked an easy solution). Here we go: I have a dataset with 2 datatables in it. Now, I need to do the following: if ds.table(0).rows(0).item("col1") = ds.table(1).rows(0).item("col2") then txtResult.text = ds.table(1).rows(0).item("col3")
3
1953
by: Megan | last post by:
hi everybody- i'm having a counting problem i hope you guys and gals could give me some help with. i have a query that retrieves a bevy of information from several different tables. first let me give you a little background. this database is kind of like a human resources database. it collects info about people, where they work, and if...
3
2059
by: Peter | last post by:
Hi, This post is about counting rows and finding the max count in a group of rows. I'm trying to find the player who scored the most goals in a game. I know how to find out how many goals the players scored, but I do not know how to find the player who scored the most goals in a specific game. The tables:
1
3886
by: tangus via DotNetMonster.com | last post by:
Hello all, I'm really struggling with getting some Active Directory code to work in ASP.NET. Can you please provide assistance? I am executing the following code: Dim enTry As DirectoryEntry = New DirectoryEntry("LDAP://domain") Dim mySearcher As New DirectorySearcher(enTry) Dim resEnt As SearchResult mySearcher.Filter =...
9
1157
by: Miky | last post by:
I have the following problem: I am populating a dataset but, sometimes (NOT always), the NewRow method works like the Add method. SetRightDetail.RightDetail.Rows.Clear() For Each Right In TblRight.Rows With Right Detail = SetRightDetail.RightDetail.NewRow() (1) Detail.Item("PKID") = .Item("PKID") (2)
5
1410
by: Mr | last post by:
Hi We have a application with Framework 1.1 and Vs .NET 2003. the application has a service with pooling; like a File system Watcher, but works. the system works fine in the development enviroment with a performance very good; but production not. -------------------------------------------------------------------------------------------
0
1190
by: gwilliam | last post by:
Problem with checkboxes in webpages. I am trying to re-set the values of dinamically created checkboxes in a web page, but no matter what I try the "Checked" property is not set correctly. A control on the page does a PostBack which in turn calls the following code: strSQL = "usp_TradeShow_GetAllAttendeeClasses_Sel " &...
3
25668
by: Jeff | last post by:
hey ..NET 2.0 I have a datatable which consist of 3 columns (int, date, value). This DataTable have 3 rows, the values of the "date" ("date" column is of datetime datatype) column is: 2007-09-15 00:00:00.000 2007-10-15 00:00:00.000 2007-11-15 00:00:00.000
0
7664
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7948
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3642
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
923
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.