Skip to content
Advertisement

Tag: mysql

SQL query for multiple tag inclusion

I´m net very good in explaining this. But i do my best: I’ve made a tagging tool for people. Some people contains more then 1 tag, and i need to get those but dont know how to write the SQL query for multiple tag inclusion. I know you can’t write WHERE conditions like this: LOWER( peoples_tags.tag_id ) = ‘outside’ AND

How can I append a string to an existing field in MySQL?

I want to update the code on all my record to what they currently are plus _standard any ideas? So for example if the codes are apple_1 and apple_2 I need them to be apple_1_standard and apple_2_standard Before: Psuedo Query: Expected result: Answer You need to use the CONCAT() function in MySQL for string concatenation:

Mysql Complex Where Clause

I really surprised when I tried below code in MySQL: It doesn’t work. I need to get product that is both free_shipping is ‘yes’ AND price equal ‘5’ at the same time. How can I create this query properly? Table Structure: contents: (TABLE 1) content_fields: (TABLE 2) Example (Get product that has 1 ID and its shipping is FREE): Answer

mysql CREATE VIEW not working from mysql_query

I have a code to create VIEW in mysql database which is working fine on my local server. It creates and crop view normally. But on my Online server it gives error for online database I manually create VIEW in Database form PHPmyAdmin [Myadmin is in localhost online] it creating, SO i have permission to create VIEW on online database.

How to get the difference between two dates rounded to hours

I’ll illustrate what I would like to get in the following example: Using TIMEDIFF(), we get 2 as a result. This means, it’s not considering the 50 minutes left. In this case, what I’d like to get is: 50 (minutes) / 60 = 0.83 period. Therefore, the result should be 2.83 and not 2. Answer

SQL: How to select 1st, 3rd, 11th and nth row from a table?

How to select 1st, 3rd, 11th and nth row from a table? Answer If there is a primary key defined for the table that is an integer based data type–both MySQL and SQLite have auto_increment for example–then you can use: …where id is the auto_increment column. There’s very little detail to go on, but MySQL and SQLite do not have

Getting first day of the week in MySql using Week No

How do I get the first day of a given week whose week number is available? For example as I write this post we are at WEEK 29.I would like to write a MySQL query that will return Sunday 18 July using this WEEKNO 29 as the only available parameter. Answer You can use: This would give you the Monday

Advertisement