I have a table looks like Here user id 1 exist in level 1 and level 2 Now when we count group by level then in counting we want ignore user_id 1 from level 1 cause it exist another group. we want to consider only one group existing and higher group. I have done only group count but cant understand
Tag: mysql
Filtering SQL results by date
Here is my query for a maintenance dates list. The idea is.. Everyday the server will email customers to let them know which checkdates are coming, based on the days notice that is set for that type of check. (see image) Currently it is showing all checkdates. All i need to do is filter the list so it only sh…
How can I find datas smaller than “this sunday” in mysql
I have a mysql table and a date colomb that show when I add datas… I wanna select datas smallar than this sunday from table.. HOw can I do that_? here is my code… I couldnt figure it out “sevk_tarihi < DAY(3)”… Answer I am sorry, I misunderstood the question This gives you pas…
How to achieve partition by kind of functionality using variables in MySQL 5.7
I’m using an old version of MySQL. I cannot upgrade it due to some strong reasons. I’ve a table PatientAppointment with only 2 columns. Here is the table: I want 5 things: Create a new column in runtime monthOfCheckup from dateOfCheckup Convert duration into integer field as minutes Accumulating t…
Different user login problem because of the syntax error [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 In my program, I want different users to have different class_id in order to let them go int…
MySQL show proportion
I am trying to show a proportion of customers that signed up because he/she was being referred by other customers and customers with no referral. So far I only able to show it as numerical but I wanted to show it in percentage. Null is when the customer signs up without being referred. The original data as fo…
MySql regexp on column with html
I have a table with HTML content in which I need to select all rows containing a span element with the CSS class “glyphicon glyphicon-film” with some text content, but exclude all rows …
How to convert time given as string into integer mins
What I’m trying to ask is that I’ve a table Duration. It has only one field elapsed and it is VARCHAR. The table is this: I want this table: total should be integer or number. I’ve to perform some arithmetic on it later. Here’s what I tried: Please help me. Note: I need MYSQL query not…
how to update column with row number in group by result in MySQL
Sample Data: Desire Data: how to write a sql to update the room seat number to serial num in MySQL 5.7? the room’s seat is from 2-20. Answer One option uses the update/join syntax. In MySQL 5.7, where window functions are not available, you can emulate row_number() with a correlated subquery (which is s…
How to calculate running sum for each group in MySQL
Straightforward summation I can do with sum() function. But I’ve a different situation here. I’ve a table Student with only 2 fields. For instance just assume that there is only 1 student in the entire class: And I have his scores for the days when exams were taken with one more column in the runt…