Skip to content

Tag: mysql

Whats the right syntax to CONCAT in wpdb?

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…

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 …

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&#…