Rabu, 05 Juni 2024

COMBOBOX & SELECT2

Cara Query Select IN yang didalamnya mengandung Tabel yang sama

 -- AKAN MUNCUL ERROR, KARENA TIDAK BISA SELECT DI TABEL YG SAMA, HARUS DIAKALI SEPERTI DIBAWAH INI:
-- 1093 - You can't specify target table 'master_qr_code' for update in FROM clause 

delete from master_qr_code where id_master_qr_code in (select a.id_master_qr_code from
master_qr_code a <<< DARI INI
left join pembelian_detail b on a.kode_batang_master_qr_code=b.kode_batang_pembelian_detail where isnull(b.nama_pembelian_detail) and a.id_jenis_transaksi=1);

delete from master_qr_code where id_master_qr_code in (select a.id_master_qr_code from
(select * from master_qr_code) a <<< MENJADI INI
left join pembelian_detail b on a.kode_batang_master_qr_code=b.kode_batang_pembelian_detail where isnull(b.nama_pembelian_detail) and a.id_jenis_transaksi=1);

Minggu, 02 Juni 2024

Install Mosquito MQTT Server pada Ubuntu 22.04

apt-get install curl gnupg2 wget git apt-transport-https ca-certificates -y
add-apt-repository ppa:mosquitto-dev/mosquitto-ppa -y
apt install mosquitto mosquitto-clients -y

nano /etc/mosquitto/mosquitto.conf
#####TAMBAHKAN DIBAGIAN PALING BAWAH FILE#####
allow_anonymous true
listener 1883
#####

service mosquitto restart
systemctl status mosquitto

#####CARA PAKAI#####
mosquitto_sub -h 127.0.0.1 -t "wapiku/status"

mosquitto_pub -h 127.0.0.1 -t "wapiku/status" -m "NAMACLIENT"

crontab -e
* * * * * mysql -u root -pPASSWORDMYSQL -h 127.0.0.1 wapiku3_3 <<< "SELECT COUNT(*) FROM wapiku3_3.kirim WHERE status_kirim='1';" &> /tmp/status
* * * * * mosquitto_pub -h MQTTSERVER -t "wapiku/status" -m "NAMACLIENT: $(tail -1 /tmp/status) | updated: $(date)"

Selasa, 17 Oktober 2023