?
Solved

Out the count variables

Posted on 2016-07-18
6
Medium Priority
?
58 Views
Last Modified: 2016-07-22
Hi all, I would like to get the out of the count...

Select * from tickets where event_ID=20

Output:

2x USD
3x SGD
5x AUD

I Don't want the count, I just want the output.

This is so I can do less queries on the page, relating to currency conversion
0
Comment
Question by:Graeme
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 41717087
what do you mean by
I Don't want the count, I just want the output.

?
can you elaborate more?
0
 

Author Comment

by:Graeme
ID: 41717181
Hi Ryan, sorry the mobile app isnt as good as the PC

So the Query I currently have is:

Select * from tickets where event_ID=20

Open in new window


its output is:
USD
USD
SGD
AUD
AUD
SGD
SGD
AUD
AUD
AUD

I know if I do a count of these, its
2x USD
3x SGD
5x AUD

but I do not want the count (the numeric number)

I want the output (3 different types)
USD
SGD
AUD

hope this makes more sense
0
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 2000 total points
ID: 41717227
i'm not too sure if I understand you, but think you can use a Group By clause here?

like:
Select currencyfield
from tickets
where event_ID=20
group by currencyfield
order by by currencyfield

Open in new window

see if this is what you want?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Graeme
ID: 41717231
Oh that might be the way, let me try it out, will get back to you soon

Cheers!
0
 

Author Closing Comment

by:Graeme
ID: 41722147
Perfect mate! cheers!
0
 
LVL 6

Expert Comment

by:worthyking1
ID: 41724931
A much simpler way is to use the DISTINCT method, as follows:

Select DISTINCT CurrencyType from tickets where event_ID=20

Open in new window


* Obviously replace "CurrencyType" above with your actual column name. You can also add ORDER BY if needed to sort the results.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question