Skip to content

Tag: mysql

Why did I sum the wrong result?

I’d like to have an advice for this SUM that doesn’t work as expected. I have to SUM data from the same day and display it in a table. I did a query like this: This is the ‘simple’ one and it displays every single row, I have to put a SUM in it to make it show every day

Suggestion for a contact management database design

I am currently designing a contact management database for a chamber of commerce. The goal of the database is to store all the person (except our own staff), all recorded companies (regular companies and member of the chamber), addresses of the person and companies, tasks that the staff are currently responsible for, a list of our staff (user) and the

MySQL script triggers Error #1241

I have the script below, which is supposed to get a price for an array of ID’s that has been provided. But it needs to get 1 price per ID, and the tricky part is, that I want to have the ability to have scheduled price updates. This mean that it needs to take the price that is <= UTC_TIMESTAMP

MySQL aggregated sum of JSON objects

I have created new table and having details as JSON datatype. I tried to get the aggregated sum of all records. I can able to get the each values but I don’t know how to get the sum using group by …

Importing certain columns from csv into mysql via command line

I have a csv file and want to import part of it into my Mysql database. From this question, I tried this command in my Mysql command line Those in bracket is the columns I want to put in my table. The order is same to my table but not same to csv file. And the mysql didn’t do anything

SQL Query Confused

Display: account no. customer id initial amount in terms of lakhs (rounded off to 2 decimals) [change the column heading to ‘INITIALAMTIN_LAKHS’] amount category(amt < 50000 show as 'Low', amt > …

java.sql.SQLException: Geometry byte string must be little endian

I want to use the contains function to get all values whose title or question contains a certain value. However, I get this error: java.sql.SQLException: Geometry byte string must be little endian. at com.mysql.jdbc.SQLError.createSQLException( at com.mysql.jdbc.MysqlIO.checkErrorPacket( at com.mysql.jdbc.MysqlIO.nextRowFast( at com.mysql.jdbc.MysqlIO.nextRow( at com.mysql.jdbc.MysqlIO.readSingleRowSet( at com.mysql.jdbc.MysqlIO.getResultSet( at com.mysql.jdbc.MysqlIO.readResultsForQueryOrUpdate( at com.mysql.jdbc.MysqlIO.readAllResults( at com.mysql.jdbc.MysqlIO.sqlQueryDirect( at com.mysql.jdbc.ConnectionImpl.execSQL( at com.mysql.jdbc.PreparedStatement.executeInternal( at com.mysql.jdbc.PreparedStatement.executeQuery( at SQL.Select.getRecentQuestions( at org.apache.jsp.Questions_jsp._jspService(

Order by SQL line

How would I go about creating an SQL line that puts each car from new to old (Years) but also keeps it in alphabetical order For example it needs to do this This is how its displaying MY View Answer You may try the following query: The call I make to SUBSTRING_INDEX extracts the second word from the model string.