473,698 Members | 2,869 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 1334
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
3553
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
1419
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
1824
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
2816
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
1297
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
1301
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
1472
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
4149
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
8674
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
9157
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...
1
8893
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7723
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
6518
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
5860
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();...
1
3045
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
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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.