Skip to content
Advertisement

Tag: mysql

MySQL: Count the distinct rows per day

I have an interesting query I need to do. I have a table with an INT column containing ip address numbers (using INET_ATON), and a timestamp column. I want to be able to count the number of unique ip address columns there are per day. That is, how many distinct ip rows there are in each day. So, for example,

make text column as unique key

i want to make a table in MySQL server with mediumtext column as UNIQUE KEY but this made an error when I change the type of `name` to varchar .. it works! can you tell if i can to make text column as UNIQUE KEY Answer Basically you can not use Text column as UNIQUE key. Because practically such a

How do I put an ‘if clause’ in an SQL string?

So here’s what I want to do on my MySQL database. I would like to do: If that would not return any rows, which is possible through if(dr.HasRows == false), I would now create an UPDATE in the purchaseOrder database: How would I be able to make this process a little shorter? Answer For your specific query, you can do:

MySQL error with Not unique table/alias with join

I have this sql query which gives me the error “Not unique table/alias”. This is not the case as “studii” is the only table with that name. Why does this error show up? Answer in this care you are referring to 2 different selections of a table with the same alias (studii)

ISDATE() equivalent for MySQL

I have a line of code for SQL server which takes a date listed as “YYYYMMDD” where the DD is 00 and converts the 00 to 01 so that it works with datetime. I would like to be able to use MySQL for it the current code which works for SQL server: but isdate is not valid in MySQL, what

MySQL query to return AVG

Just a practice problem, little bit confusing I’d appreciate it if somebody could clear this up.. I have a DB called Product and another one called PC. I’m trying to execute a query to “find the average hard disk size of a PC for all those manufacturers who also make printers” Here’s my code: type is an attribute of Product

ERROR 1452 (23000): cannot add or update a child row. [closed]

It’s difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 9 years ago. what could be the problem here?help me please 🙂 and please explain hehe

Advertisement