How to add the Counts of 2 tables in sybase!


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to add the Counts of 2 tables in sybase!
# 1  
Old 12-06-2011
How to add the Counts of 2 tables in sybase!

Hi All,

I'm a newbie here, i'm just wondering if it's possible to add the total counts of 2 tables.

ex.
Table1
-- 100 counts

Table 2
--50 counts

what i'm going to do is add the two table. is it possible.

Thanks,
# 2  
Old 12-06-2011
Try this ..
Code:
select sum(amount) from 
( 
select count(*) amount from schema.tab1 union all select count(*) amount from schema.tab2 
)

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Search last column of INPUT.txt in TABLEs text and add correspond columns to INPUT.txt

Hi dears i use bash shell i have INPUT.txt like this number of columns different in one some row have 12 , some 11 columns see last column INPUT.txt CodeGender Age Grade Dialect Session Sentence Start End Length Phonemic Phonetic 63 M 27 BS/BA TEHRANI 3 4 298320 310050... (2 Replies)
Discussion started by: alii
2 Replies

2. UNIX for Dummies Questions & Answers

Get counts from List

This is very easy , but I`m struggling .. please help modify my script, I want to count the number of h and n , from the second column group by the first. The second column is binary, can only have h and n. a h a h a n a n a h b h b h b h b h b h c n c h c h c h c h (2 Replies)
Discussion started by: jianp83
2 Replies

3. Linux

IP Tables Add Open Port 3306

Hi, Anyone can help me on how to open a port 3306 on Centos 5 for my localhost (127.0.0.1), currently I have the list iptables -L; Chain INPUT (policy ACCEPT) target prot opt source destination RH-Firewall-1-INPUT all -- anywhere anywhere Chain FORWARD (policy ACCEPT) target prot opt... (7 Replies)
Discussion started by: fspalero
7 Replies

4. Shell Programming and Scripting

counts based on percentage

I have a file with multiple entries and I have calculated the percentages. Now I want to know how many of my entries are there between 1-10% 11-20% and so on.. chr1_14401_14450 0.211954217888936 chr1_14451_14500 1.90758796100042 chr1_14501_14550 4.02713013988978 chr1_14551_14600 ... (3 Replies)
Discussion started by: Diya123
3 Replies

5. Programming

SQL Add to Multiple Tables

I'm pretty new to the database world and I've run into a mental block of sorts. I've been unable to find the answer anywhere. Here's my problem: I have several tables and everything is as normalized as possible (as I've been lead to understand normalization.) Normalization has lead to some... (1 Reply)
Discussion started by: flakblas
1 Replies

6. UNIX for Dummies Questions & Answers

counts

To start I have a table that has ticketholders. Each ticket holder has a unique number and each ticket holder is associated to a so called household number. You can have multiple guests w/i a household. I would like to create 3 flags (form a, for a household that has 1-4 gst) form b 5-8 gsts... (3 Replies)
Discussion started by: sbr262
3 Replies

7. Shell Programming and Scripting

to grep and print their counts

suppose u have a file ACFCFACCACARCSHFARCVJVASTVAJFTVAJVGHBAJ another file A C F R then output shud be A= 9 C=7 F=3 R=2 Thanks (12 Replies)
Discussion started by: cdfd123
12 Replies

8. Shell Programming and Scripting

Converting tables of row data into columns of tables

I am trying to transpose tables listed in the format into format. Any help would be greatly appreciated. Input: test_data_1 1 2 90% 4 3 91% 5 4 90% 6 5 90% 9 6 90% test_data_2 3 5 92% 5 4 92% 7 3 93% 9 2 92% 1 1 92% ... Output:... (7 Replies)
Discussion started by: justthisguy
7 Replies

9. UNIX for Dummies Questions & Answers

counts

How can i do a simple record count in my shell script? i just want to count the number of records i receive from a specific file. (11 Replies)
Discussion started by: k@ssidy
11 Replies
Login or Register to Ask a Question