Solved

Out the count variables

Posted on 2016-07-18
6
55 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 51

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 51

Accepted Solution

by:
Ryan Chong earned 500 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

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

Suggested Solutions

Title # Comments Views Activity
How to get statistic's from a competitors website?! 1 128
IIS components 2 35
Boolean 13 24
GitHub 1 10
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 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