Solved

Out the count variables

Posted on 2016-07-18
6
47 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
  • 3
  • 2
6 Comments
 
LVL 49

Expert Comment

by:Ryan Chong
Comment Utility
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
Comment Utility
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 49

Accepted Solution

by:
Ryan Chong earned 500 total points
Comment Utility
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

Author Comment

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

Cheers!
0
 

Author Closing Comment

by:Graeme
Comment Utility
Perfect mate! cheers!
0
 
LVL 6

Expert Comment

by:worthyking1
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now