I’m quiet new in working with wordpress database tables. So far I know because of the wpdb documentation how to update a row in a table. Now i want to achive to update the row and keep the old data in that row. I’ve read that you can use the CONCAT function to get this working but I’ve no cl…
Tag: mysql
How to get incremental values running in another column
I have a sample Data like this I’m trying to get result like this I have tried with row number but not able to move forward. Answer If you’re not doing this with tens of thousands of records at a time, you could try something like this: This will give you the result based on this source data:
match against doesn’t work with the word “when”
When desc contains the string: zoom when wifi dies for 1 second Query 1: No problem, I get the row! Query 2: No results! So when belongs to sql commands. So how to solve this? Answer You need to learn some basics about full text search. One very important concept are stop words. These are words that are not i…
how to sum two columns from different tables MySQL
I need to sum the data from two different columns located in different tables and grouped by session_id….. I need to sum the column of spent_points + price_points grouped by session_id this is the result i hope to get I have tried with this query but I have only managed to group the data but I have not …
Add OR in WHERE
I have SQL query: And I want to adjust it so it looks for p.post_status = ‘publish’ OR p.post_status = ‘t_active’. I tried: But it didn’t work. How do you achieve this? This is an entry level question – SQL is not my jazz. Answer You need to use brackets to make clear what …
Having trouble creating set-based query to create table data instead of doing it procedurally
Given table settings with unique key of id+appId id appId name 1 app1 setting1 2 app1 setting2 I have created new entries and the table looks like so id appId name 1 app1 setting1 2 app1 setting2 3 app2 setting1 4 app2 setting2 Then given table user_settings that connects settings to a user userId settingsId …
is there a sql query I want to get last job_id with the earliest start date
is there a sql query I want to get last job_id with the earliest start date. I have a table named employee expected results Answer First, use FIRST_VALUE() window function to get the latest job_id for each employee_id and then use conditional aggregation to get the earliest start_date for this job_id: See the…
select count with another select and inner join
Is it possible to use two “select” in the same query? I tried it but got the syntax error several times. My query example: I would like the result shown to be all queries on the screen. Basically, what I want is that the result shown when executing the query is the first and second “select&#…
MySQL, Determine number of customer doing first transaction on certain store
I have transaction table as below “I want number of newly registred customer who did their first transaction on Store1 during July 01 – July 30” In this case the expected result is 1 which is CustomerID B with OrderID 4 How to query out the data with using EXISTS / NOT EXISTS, but not using …
How do I insert data into a table where one of the values should be a foreign key from another table?
I wanted to update the post table (main table) with those data: However, the post table userid column only accepts an integer (foreign keys from the user table (userid)), not username string itself. How can I do this with INSERT, SELECT/WHERE query? There are the tables. post user Here is what it should look …