Ok I have looked at multiple entries in stackoverflow for this but cant seem to quite work them for me. I have a table called email_Archive It contains every email sent by every user. Columns in Db are: Challenge: I am trying to get the average amount of emails sent by a select list of users per day for the
Tag: mysql
Count(*) of two sql statements where results are subset of another one
I have a table which has ~500 GBs of data and have two queries running on it. I feel Query 2 execution on whole table is un-necessary as the results are subset of Query 1. Is there any optimized way to first execute Query 1 then run Query 2 on the results of it and finally return Count of both
Getting the data from SQL and inserting it inside the Java Textfield
I’ve been trying to get the data from the SQL and insert it inside the JTextfield. This code is in the button action, but when I clicked the button, there is nothing happening. Answer I redo my JFrame and rewrite this code. There is no problem with this code. I think it just override because I copied th…
How to select a table that have one to another and another table relationship
I don’t know if the question make sense or not. I’m trying to request information from 2 different tables that are linked (via FK) to a table and display the data with information from that linked tables. post user role Is there a way to select/show this table?: result Answer Try this:
error : 1242 – Subquery returns more than 1 row
I am trying to calculate the total credits for each studentID in the enrollment table. I have some repeated studentIDs which means that the same student is already enrolled in many sections and each section has different credit. When I tried these queries It made all studentIDs have the same sum of credits as…
How to create a public id?
I have a database. As you can see the primary key is an auto_increment and is also unique. I read that publically sharing a row’s primary key of a table to the public is unsafe. I want to assign each row in customers a unique ID that I can publically share. How can I do this without having to specify
How to select max and min of 1 column based on other 2 columns?
I’m trying to get the max and min date values in column C based on the (column A, column B) unique pair combinations. Suppose I have a table like: The output I want to get is: My attempt query has been taking 20 mins to run with no output yet (just tried to get max date from column C for
How to find the desired output using hive/sql
I have a table like this col1 col2 First row Second a First b Second row First c Second row The output required is like below: col1 col2 col3 First row 1 Second a 1 First b 1 Second row 2 First c 2 Second row 3 The logic is , whenever we are getting the value “row” in col2,
Change td content according to database
I have two table for assignments. TABLE1 has the data of the assignments posted by a faculty and TABLE2 has data of those students who submitted the assignments. Both table have one similar column called ‘assignment name’. My TABLE2 has a status column which is boolean data. By default i have set …
Complex mysql query counting
I have 1 table name “companies” with several datas like : Id Owner Company Job 1 John Doe Company 1 CEO 1 John Doe Company 2 CEO 1 John Doe Company 3 CEO 1 Gab Durand Company 4 CEO 1 Rob Dujn Company 5 CTO 1 Alex DoeMorse Company 6 COO What I need is to get 1 line by