1. select * from MyDataBase
2. select count(*)as total_child,dir ect_mngr_person nel_number as personnel_numbe r from MyDataBase group by direct_mngr_per sonnel_number
both of the query statement is came from same table
i need it into 1 so that i can call it to dataSet..
Pls....
help me....
i hav no idea already....
6 1623
If both the query return similar column list and datype you can go for UNION.
If both the query return similar column list and datype you can go for UNION.
ya..i tried it just now...but cant because of "group by"
debasisdas,
may i ask that is it possible if i use left join?
Maybe you're looking for something in the likes of this: -
SELECT direct_mngr_personnel_number, and_the_other_columns_you_need, totalcount.total_child
-
FROM MyDataBase
-
INNER JOIN (SELECT COUNT(*) AS total_child, direct_mngr_personnel_number FROM MyDataBase
-
GROUP BY direct_mngr_personnel_number) totalcount
-
ON MyDataBase.direct_mngr_personnel_number = totalcount.direct_mngr_personnel_number
-
On the last line I took a wild guess that direct_mngr_per sonnel_number is your primary key. If it's not, change it to your primary key.
ya..i tried it just now...but cant because of "group by"
debasisdas,
may i ask that is it possible if i use left join?
What is the error that it is displaying??
Maybe you're looking for something in the likes of this: -
SELECT direct_mngr_personnel_number, and_the_other_columns_you_need, totalcount.total_child
-
FROM MyDataBase
-
INNER JOIN (SELECT COUNT(*) AS total_child, direct_mngr_personnel_number FROM MyDataBase
-
GROUP BY direct_mngr_personnel_number) totalcount
-
ON MyDataBase.direct_mngr_personnel_number = totalcount.direct_mngr_personnel_number
-
On the last line I took a wild guess that direct_mngr_per sonnel_number is your primary key. If it's not, change it to your primary key.
yaya...similiar tat....
Thx for giving me idea, i had done it successfully with following:
select a.*, b.total_child from MyDataBase a left join (select direct_mngr_per sonnel_number as personnel_numbe r, count(*) as total_child from MyDataBase group by direct_mngr_per sonnel_number) b on a.personnel_num ber = b.personnel_num ber where lower(a.firstna me) like '%" + TextBox1.Text.T oLower.Replace( "'", "''") + "%' and lower(a.lastnam e) like '%" + TextBox2.Text.T oLower.Replace( "'", "''") + "%'order by " + DropDownList1.S electedValue.To String + " asc"
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Barry Young |
last post by:
I am using Access to create a SQL query. It creates an Inner Join Query. I cut and paste the query into PL-SQL. When I try to execute the query I get an error.
ORA 933 SQL command not properly ended.
It highlights the INNER JOIN statement on the SQL command.
Can someone recommend a utility to convert these Microsoft or Access SQL queries to PL SQL?
Thanks!
|
by: B. Fongo |
last post by:
I learned MySQL last year without putting it into action; that is why
I face trouble in formulating my queries. Were it a test, then you
would have passed it, because your queries did help me solve my problem.
I'll turn to MySQL doc after getting through this pressing project.
Thanks a lot Roger!
Babale
-----Urspr=FCngliche Nachricht-----
|
by: kieran |
last post by:
Hi,
I have the following SQL statement which is pulling a few details from
a database. As you can see, there is only the one table from which i
am creating a temporary copy.
The reason I do this is because in the table i only have the 'standIn'
listed by integer and i want to return the 'standIn' by name.
I hope this is clear enough.
|
by: stabbert |
last post by:
I am attempting to join two tables together on two different unix
servers. Here is some relevant info about the tables.
TABLE 1 Setup
-----------------------
DB2 UDB 7.2 EE
|
by: Ryan |
last post by:
I want to do the following SQL statement in Access. However, it won't
allow me to have the secondary part of my join statement and tells me
that this is not supported. OK, so Access doesn't support it, but there
must be an alternative.
I can add the part 'D.Dealer_Code' to the where clause, but because of
the way that the statement is executed, it excludes data that I want.
My SQL statement is perfectly leagal and works fine, but Access...
| |
by: dmonroe |
last post by:
hi group --
Im having a nested inner join problem with an Access SQl
statement/Query design. Im running the query from ASP and not usng the
access interface at all. Here's the tables:
tblEmployees
empId -- EmpName -- EmpRole -- EmpManager
-------....------------.... ---------....---------------
1........ dan yella..........1..........2
|
by: MP |
last post by:
Hi
trying to begin to learn database using vb6, ado/adox, mdb format, sql
(not using access...just mdb format via ado)
i need to group the values of multiple fields
- get their possible variations(combination of fields),
- then act on each group in some way ...eg ProcessRs (oRs as RecordSet)...
the following query will get me the distinct groups
|
by: Zeff |
last post by:
Hi all,
I have a relational database, where all info is kept in separate tables
and just the id's from those tables are stored in one central table
(tblMaster)...
I want to perform a query, so all data from the separate tables is shown
in a view (instead of the reference id's pointing to the separate tables...)
I have some troubles formulating the SQL statement:
I tried:
|
by: cjakeman |
last post by:
Hi,
Solved a little mystery yesterday when I built a form that combined 2
tables with a 1:M relationship and relational integrity. All the
correct data was visible on the form but, if I tried to edit any of
the fields, the PC bleeped.
Seems it was due to the query the form was based on. Again, editing
any of the fields of the query caused the PC to bleep.
|
by: rrstudio2 |
last post by:
If I have two tables and need to do a left outer join and include a
where statement on the second table, it seems like the left outer join
becomes an inner join. For example:
Table: Names
id Name StatusCode
1 John 11
2 Henry 22
3 Bob 33
|
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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 into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |