Hi, isit possible to add data to mysql database from telegram bot?

|
Swapnil 2022-06-23 16:10:06
Can you share expected output ?
Swapnil 2022-06-23 16:54:07
select distinct
id, phase, count(*) over (partition by id, phase) as cnt
from tablename
order by id,phase
Lauris 2022-06-23 19:43:23
Hi, isit possible to add data to mysql database from telegram bot ?
MasterZiv 2022-06-23 19:44:57
Lauris 2022-06-23 19:43:23
Hi, isit possible to add data to mysql database from telegram bot ?

Definitly, yes, possible

MasterZiv 2022-06-23 19:45:26
Swapnil 2022-06-23 16:54:07
select distinct
id, phase, count(*) over (partition by id, phase) as cnt
from tablename
order by id,phase

this is wrong query

Swapnil 2022-06-23 20:18:40
MasterZiv 2022-06-23 19:45:26
this is wrong query

Can you elaborate ?

MasterZiv 2022-06-23 20:46:41
Swapnil 2022-06-23 20:18:40
Can you elaborate ?

no

Swapnil 2022-06-23 20:51:16
MasterZiv 2022-06-23 20:46:41
no

Whats the point in wrong query then.
Pity🤦

MasterZiv 2022-06-23 20:52:36
Swapnil 2022-06-23 20:18:40
Can you elaborate ?

DISTINCT and aggregates canot be in the same query, aggregates cannot be without group by

Swapnil 2022-06-23 20:53:21
MasterZiv 2022-06-23 20:52:36
DISTINCT and aggregates canot be in the same query, aggregates cannot be without group by

Who told you
Go and execute the query you will get the expected result

Swapnil 2022-06-23 20:54:04
By the way count() over is not aggregate , ita window function
MasterZiv 2022-06-23 20:55:00
Swapnil 2022-06-23 20:54:04
By the way count() over is not aggregate , ita window function

That is true.

Swapnil 2022-06-23 20:55:49
MasterZiv 2022-06-23 20:55:00
That is true.

Actually i had executed the query with expected result and then pasted the query here

Preesha N 2022-06-24 12:07:16
Swapnil 2022-06-23 16:10:06
Can you share expected output ?

mysql_en-22049.jpg
Swapnil this is expected output

adiamrit 2022-06-24 12:17:19
Anyone having stored procedures questions
adiamrit 2022-06-24 12:17:28
Please help me
Swapnil 2022-06-24 12:18:40
Preesha N 2022-06-24 12:07:16
Swapnil this is expected output

I have tried below and is working fine as expected

— create table
create table test (id int, phase text);

— Inserted demo records
insert into test values (1,’A’);
insert into test values (1,’B’);
insert into test values (1,’A’);
insert into test values (2,’A’);
insert into test values (2,’A’);
insert into test values (2,’A’);
insert into test values (2,’C’);
insert into test values (2,’D’);

— Working Query
select id,phase,(select count(distinct phase) from test a where a.id=b.id) as phase_count
from test b
order by id

Output:
id | phase | phase_count
—- ——- ————-
1 | A | 2
1 | B | 2
1 | A | 2
2 | A | 3
2 | A | 3
2 | A | 3
2 | C | 3
2 | D | 3

Swapnil 2022-06-24 12:19:30
adiamrit 2022-06-24 12:17:19
Anyone having stored procedures questions

What issue you have ?

vik3rn3s 2022-06-24 15:46:08
Hello, any way for detect a change in a table?
BrioStoCazz 2022-06-24 15:52:51
vik3rn3s 2022-06-24 15:46:08
Hello, any way for detect a change in a table?

Trigger?

vik3rn3s 2022-06-24 15:54:56
BrioStoCazz 2022-06-24 15:52:51
Trigger?

Thanks

Anuj Yadav 2022-06-24 16:00:41
Any one know anything about this
@last_entry in mysql
Swapnil 2022-06-24 16:08:25
Anuj Yadav 2022-06-24 16:00:41
Any one know anything about this
@last_entry in mysql

SELECT MAX(id) FROM mytable
or
SELECT * FROM mytable ORDER BY id DESC LIMIT 1

Anuj Yadav 2022-06-24 16:10:02
“@last_entry” not last entry
Anuj Yadav 2022-06-24 16:10:22
Previous row for every present row
Swapnil 2022-06-24 16:23:25
Anuj Yadav 2022-06-24 16:10:22
Previous row for every present row

is there any id in the table ?

Anuj Yadav 2022-06-24 16:23:42
Date is there
Anuj Yadav 2022-06-24 16:23:46
Not id
Anuj Yadav 2022-06-24 16:24:49
Swapnil 2022-06-24 16:23:25
is there any id in the table ?

But go on about the id

Gunnyvenkat 2022-06-24 17:16:34
How to find stored procedure dependency in a table
adiamrit 2022-06-24 19:31:37
Swapnil 2022-06-24 12:19:30
What issue you have ?

I’m preparing for the interview on SQL

Swapnil 2022-06-24 19:36:08
Anuj Yadav 2022-06-24 16:23:42
Date is there

select * from table
where date < (select data from table where date = now())
order by desc limit 1

Liran 2022-06-26 10:24:50
How can I know when a query was running by reading mysql slow log?

Time: 2022-06-25T23:22:12.134584Z
User@Host: user[user] @ [1.1.1.1] thread_id: 12631872 server_id: 34534534
Query_time: 5441.241800 Lock_time: 0.000278 Rows_sent: 17930 Rows_examined: 484011894
SET timestamp=1656199332;
query….

those timestamp are when it was written to the log right?

svart 2022-06-26 13:52:26
Liran 2022-06-26 10:24:50
How can I know when a query was running by reading mysql slow log?

Time: 2022-06-25T23:22:12.134584Z
User@Host: user[user] @ [1.1.1.1] thread_id: 12631872 server_id: 34534534
Query_time: 5441.241800 Lock_time: 0.000278 Rows_sent: 17930 Rows_examined: 484011894
SET timestamp=1656199332;
query….

those timestamp are when it was written to the log right?

Yes

Liran 2022-06-26 14:34:48
svart 2022-06-26 13:52:26
Yes

how can i know when it was starting to run? not to log

|