473,725 Members | 2,197 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Please help to achieve this output

1 New Member
The following is the query

select a,b,count(1) count from tbl group by a,b order by a,b

which will give the output like this

a b count
=============== ===============
18 A 16
18 B 6
18 C 7
18 D 9
19 A 16
19 B 6
19 C 7
19 D 9
17 A 16
17 B 6
17 C 7
17 D 9


But I want the output in the following format based on the field b

a count1 count2 count3 count4
=============== =============== =============== ==
18 16 6 7 9
19 16 6 7 9
17 16 6 7 9

Any idea or help to achieve this?
Sep 1 '08 #1
1 1337
debasisdas
8,127 Recognized Expert Expert
try to use decode or case statment.
Sep 2 '08 #2

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

Similar topics

16
3555
by: Sims | last post by:
Hi, I need some help to split data using regular expression Consider the string '1,2,3', I can split it using, preg_split("/,/", '1,2,3') and i correctly get =1, =2,=3. Now if i have
3
1420
by: david | last post by:
I am developing a BBS, I find many bbs system support UBB code, they claim UBB code is safer. But I think I can achieve the same security by filter out all html tags that allowed in the system and output other < and > character as &lt; and &gt;. I could have more control in this way. I am not sure if it is the right way, could anyone with experience on this give your opinion? Thanks!
1
1827
by: batham | last post by:
Gurus, I have a mainpage.aspx webform, in the page load of this page I am displaying a text "Please wait connecting..." and then I want the user to see this output on the WebForm, while I do some backend processing. Once the backend processing is done I want to redirect the user to another page e.g. "http://www.google.com". I want to achieve the above without javascript, it should be pure ASP.Net, is this possible ?
2
2819
by: Ian N | last post by:
I have a website which puts customers into different groups, depending on the referrer they can see certain products. So for example if the referrer code = 1, they'll only be able to see the products in group 1. To achieve this I've used 2 database tables, one for all of the products, and one for the groups (AGProds) which contains 2 colums (GroupID and ProdID) the system works well and I've been happy with it.
5
1299
by: name | last post by:
Tricky I'm trying to do the following string sString = "Here is a test string"; string sFieldRef = "sString"; MessageBox.Show(sFieldRef); //How do I get this line to display: Here is a test string instead of just sString??? // I am trying to access the
0
1304
by: bobmct | last post by:
Gentlemen; I've created a class for a consistent footer ..footing { position: absolute; bottom: 0; font-size: x-small; text-align: center; width: 100%;
3
1475
by: mslyman | last post by:
Hi, I could do with some help. I have this XML. <region> <region_code>567</region_code> <store> <store_code>345</store_code> <dept> <dept_code>32</dept_code> </dept>
2
4152
by: Suhas Vengilat | last post by:
Hi All, I have a couple of stored procedures written in SQL 2000. Given below one sp. ***************************************************** ALTER PROCEDURE . ( @AcTypeName varchar(50), @GLCode varchar(50), @ErrorCode int output
0
8888
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9401
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, 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...
0
9257
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 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...
0
9113
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8097
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2635
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.