I have a table with two fields, inbound and outbound, both of which are text values. I want to get all a count of all instances of a specific value in either or both of those columns. Here’s an example of the schema with some values and my query: Here’s an SQL fiddle with the schema and my current query
Tag: mysql
SQL Query to find top 5 cumulative tweets
How to find the top 5 months with the highest number of cumulative tweets and sort it according to the number of tweets of each month. Table twitter structure is like this: Token type Month …
multidimensional “WHERE IN” condition?
As is well-known, we can simplify as follows: Is there a similar shortcut possible for “multidimensional” conditions as in the following: in a form resembling something like this ? I would be willing to count anything as a simplification that uses O(n) characters where the factor is significantly smaller than in the naive example (i.e., adding one more case makes
What cause SQL syntax error in creating table in database
When creating a table in mysql query I get the error as below. I could not understand what is causing this error. The query is as below. Answer You appear to be using Java types in your create table statement. Try using proper MySQL types and it should work:
Remaining leading zero after adding in sql
When employee_id is added by one, leading zeros are removed in the following query. SELECT SUBSTRING(MAX(ID), 6, 4)+1 FROM `employee` Here is my table. ID | Name ================= Empl_0001 |…
SELECT Primary key that refers to Foreign key
How do I write a query that compares a primary key to a foreign key to see if they refer to the same record? I was thinking something like: SELECT BookID from books WHERE BookID = Publisher, but …
My MySQL select shows only 1 result instead of all that I chose
I have a problem with this mysql exercise, could someone help me so it displays all the records I want, because now it only takes a value from the column tytul and it gives the max, min and avg from …
MySQL join another table value based on 2 different tables matching value? [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 2 years ago. Improve this question The intended result is 12(price) and pic.png(profilepic). Is this possible to join jobs and profile based on the matching job_id’s (jobs+offers), which have matching user
Django Sql ERROR 1064 when accessing table
I cannot access one of the tables in my database. I can’t even delete the table by myself, so I am not sure what to do. Here is the error: ERROR 1064 (42000): You have an error in your SQL syntax; …
SQL JOIN with WHERE condition when two rows’ values are the same and one row matches to two different rows
I have these tables: CREATE TABLE students( id int NOT NULL PRIMARY KEY, name VARCHAR(30) NOT NULL ); CREATE TABLE studentsActivities( studentId int NOT NULL, activity VARCHAR(30) NOT NULL, …