Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Now what i want to find out how many chats a given agent has taken based off the Account.. running this :
select count(*) from csa_totals where Account="1%" and User="agent_name";
now i want to see how many chats this particular agent_name has taken based off the wildcard... but it keeps returning as 0... even though the data is there... is there anything im doing wrong. ??
If the data calls it "agent_name," then so should you. Anyhow, here is your answer:
SELECT
account,
user,
COUNT(*) AS account_user_num_conversations
FROM csa_totals GROUP BY
account,
user;
Time to get a good book on SQL and start reading.
You can waste an extraordinary amount of time "shooting in the dark" if you haven't received (or provided for yourself) the proper training. If your manager doesn't realize that there's a knowledge-deficiency among his or her ranks, it's okay to be the one to tell him or her. No one gets this stuff "by osmosis."
Thanks for the tip and your response it is much appreciated. One more question. Is it possible, to for example only query specific users, and see how many chats they took and return that. Because sometimes the Account may not start with 1, for example...?
Again i appreciate the help, and the reason why im taking this over, is because our main DBA is away ill, and im the next IT resource altho my speciality is Linux, Apache and Windows etc.
We can't teach you SQL by example; it would take mths. You need to read up on the MySQL docs as linked above.
Note that normally col names are case sensitive, eg account != Account.
Also, you seem to have created usernames that actually have brackets '(' , ')' as part of the name.
That's almost definitely wrong and will cause problems because they are meta-chars used in SQL, as in other programming langs.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.