Search Posts

Month: April 2018

how to fetch same record multiple time based on date conditions in mysql?

how to – how to fetch same record multiple time based on date conditions in mysql? Table structure like id p_id payout_date 1 2 2018-04-21 MY SELECT QUERIES IS SELECT * FROM `payout` where payout_date >=’2018-04-20′ or DATE_ADD(`payout_date`, INTERVAL 30 DAY) >=’2018-05-20′ i need result like id p_id date 1 2 2018-04-21 1 2 2018-05-20 Source: Stackoverflow

MySQL: Data goes blank when try to Update a row

how to – MySQL: Data goes blank when try to Update a row So I’m trying to update the Address of a Member in a table. After I click submit on the running page on the browser, the Address value inside the database went blank. I’m not sure if that means my database didn’t receive any data, or it did but the data was considered blank? <!DOCTYPE HTML> <html> <head> <?php session_start(); if (isset($_SESSION[‘Username’])) { […]

SQL, matching all tags

how to – SQL, matching all tags I suppose that there is a really simple solution which I just can not see. The case: I have a table containing products with different kind of details aka name, brand, manufacturer, category etc. Then I have a table (which contains information about manuals with tags specifying matching criteries against to the product table. Tags can be separated to an another table if necessary. Manual matches the product […]

MYSQL query to exclude consequtive rows [duplicate]

how to – MYSQL query to exclude consequtive rows [duplicate] This question already has an answer here: SQL select only rows with max value on a column 29 answers My app has 2 types of user: buyer and driver. Messages from buyers to drivers and vice versa are stored in a single table: ‘actions’. Possible actions are ‘message’, ‘post_job’, ‘buyer_cancelled’, ‘driver_cancelled’, etc. ‘message’ actions are what my question refers to. Buyers interact with drivers, and […]

Can we create Binary Tree in java using JDBC with all operations?

how to – Can we create Binary Tree in java using JDBC with all operations? Can we create Binary Tree in Java using JDBC with all operations like insert Node, search node, delete the node, sort tree etc? JDBC table will be like create table bst (node varchar(20), leftnode varchar(20), rightnode varchar(20)); I think using this concept the binary tree operations will easy to operate and we can perform all operations without any confusion. let’s […]

sqlAlchemy execute a select row for the second time, it return nothing

how to – sqlAlchemy execute a select row for the second time, it return nothing I select and update a row data by sqlalchemy, when i execute the second time, sqlalchemy return None to me, why? db_connection = ‘mysql+pymysql://%s:%[email protected]%s/%s?charset=utf8’ % (db_user, db_pwd, db_host, db_name) engine = create_engine(db_connection, echo=False) session = sessionmaker(autocommit=False, autoflush=False, bind=engine)() while True: row = session.execute(‘select id, avi_id, address, code from job where job_status = :job_status’, {‘job_status’: ‘created’}).fetchone() if row: session.execute(‘update job set […]

I want to update only date when data comes to mysql

how to – I want to update only date when data comes to mysql CREATE TABLE `tbl_attendance` ( `att_id` int(11) NOT NULL, `rfid_uid` varchar(255) NOT NULL, `punch_time` timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ) This is working fine with timestamp but i want to take only date and time separately in 2 columns. In one there will be only date and in other there will be time. I am working on arduino attendance system when […]

I want to insert 3 images into a folder and path into mysql with new name

how to – I want to insert 3 images into a folder and path into mysql with new name I want to insert 3 images into a folder and path into mysql with new name. My table name is ‘ict’ with database ‘ctg’ Table fields are id, image1, image2, image3 Now I want to use a form containing three input type=”file” and a submit button. How is it possible with php . Thanks for quick […]

php msql rollback not rollback all change in loop

how to – php msql rollback not rollback all change in loop I tried to find why some changes were not rollback when some queries failed. It should be all rollback, but it rollback some. Server version: 10.1.24-MariaDB – MariaDB Server Apache/2.4.6 (CentOS) PHP/5.4.16 Database client version: libmysql – 5.5.52-MariaDB PHP extension: mysqli Documentation PHP version: 5.4.16 All tables are InnoDB and each query for each table $sc = TRUE; //– For result startTransection(); //— […]

executeBatch vs case when

how to – executeBatch vs case when I am using mysql 5.6 with jdbc driver, now I need to do batch update, there are two ways, one way is use mysql case when syntax like below: UPDATE yourtable SET dingdan = CASE id WHEN 1 THEN 3 WHEN 2 THEN 4 WHEN 3 THEN 5 END WHERE id IN (1,2,3) the second way is to use jdbc addBatch() and executeBatch(), for example: pstmt.addBatch(“update yourtable set […]

Next Page »