I am torn between postgreSQL and MySQL but I am forced to install the choosen one on windows. I especially need asp.net membership and i will be installing NHibernate as well.
i am using mysql database
i have a table called sales
its primary key is sales_id
-------------------------------------
sales_id | invoice_id |
-------------------------------------
1 | 147
2 | 148
3 | 150
for sales-id 3 the invoice is supposed to be 149. i want to know which numbers are missing from invoice_id (i start invoice_id is 147 and end invoice_id is 4497). The invoice_id had no relation with sales_id
is it possible to know which numbers are missing from invoice_id, using some queries??
i need to connect mysql server from other new server, the IP address of the new server is in UK. please reply me is there any possibility to connect the new one?
All,
I have a database table in mysql with a field that is of "TIMESTAMP" type. I need help writing the SQL query to update the field with the current timestamp.
UPDATE tb_Test set dt_modified = ?????
Thanks,
How do I instruct Nant to tell MySql to run ddl scripts from a particular location and then run other scripts as instructed?
Google let me to many sites which unfortunately do not work...
MySQL keeps saying my syntax is incorrect.
I want to do this:
DELIMITER $$
DROP PROCEDURE IF EXISTS `myprocedure` $$
CREATE DEFINER=`db`@`%` PROCEDURE `myprocedure`(
var_name varchar(10)
)
BEGIN
/* syntax errors below */
DECLARE countTemp integer;
SET countTemp=(SELECT COUNT(Name) FROM mytable WHERE Name= var_name);
/* more stuff */
END $$
DELIMITER ;
What's the correct syntax?
i have a mySQL table which the data in one of its columns is in a language other than English.(Persian)
when i input data in the table , it is shown properly but when i want to show the data in a php file it displays like this:????
well,what should i do in order to show the data in its correct form?
How to connect to MYSQL DB from Java, create table, insert data, retrieve it with datatypes.
How to make use of the data to/from in Flex application.
plz help me out..
i have basic knowledge in sending and receiving messages using BlazeDS.
and calling JAVA METHODS USING ...
Hello, I'm using php for making queries for mysql. Here is one:
UPDATE `subscribers` SET `curDate` = NOW() WHERE `e_mail` = "$resEmail"
curDate - DateTime type. The problem is that after this query curDate of given email is
0000-00-00 00:00:00
What's wrong?
I have a .sql file from a MySQL dump containing tables definitions and the data to be inserted in this tables. How can I convert this database represented in the dump file into a MS SQL server database?
I'm having a table, where one ID, can have multiple statuses
| client_id | status_id |
| 1 | 2 |
| 1 | 3 |
| 1 | 5 |
| 2 | 2 |
| 2 | 3 |
| 2 | 6 |
The problem is, to select only those client_id's if they have all the statuses i.e. 2,3,5 (status_id = 2 AND status_id = 3 AND status_id = 5) but mysql doesn't allow that directly.
I have a question about the snippet below. I'm wondering, if the first query doesn't bring any results, would I still get the results for the second query?
select *
from
(
-- first query
) as query1
left join
(
-- second query
) as query2
on query1.id=query2.id
left join
(
-- third query
) as query3
on query1.id=query3.id;
Update:
what I need is a full join, however, MySQL does not support it, what would be a good way to emulate this?
Is it possible to import the attributes of one table, then I put it into another table using a query in mysql?
For example I have table1 with attributes lname, fname, mname
And I want to put those attributes into table2.
Is there any query that could do that? I'm imagining that the table2 has one attribute that could later be dropped so that it will be the same as table1.
In mysql, how do I get the primary key used for an insert operation, when it is autoincrementing.
Basically, i want the new autoincremented value to be returned when the statement completes.
Thanks!
I have this mysql table called comments which looks like this:
commentID parentID type userID date comment
The commentID is set as Primary key, but most of the time I fetch the data using the parentID. How should I set my indexes?
Should I just add an index on parentID and let commentID be the primary key?
I am building a PHP and MySQL search as so
SELECT * FROM Properties WHERE Locaion = 'Liverpool'
I want to count how many of each property type there are and display them at the side of the page to use as filters (like Rightmove.co.uk).
This is what I am have come up with but can't get it to work
SELECT *,
count(PropertyType = 'house') AS HouesTotal,
count(PropertyType = 'Apartment') AS ApartmentTotal
FROM Properties WHERE Location = 'Liverpool'
Can anyone help?
So,
I can run the following statements from within mysql itself successfully.
SET @fname = 'point1';
SELECT * FROM country WHERE name=@fname;`
But when I try to pass the query through php like this and run it, I get an error on the second line
$query = "SET @fname = 'point1';";
$query .= "SELECT * FROM country WHERE name=@fname;";
I'm working with python and mysql and I want to verify that a certain entry is compressed in the db. Ie:
cur = db.getCursor()
cur.execute('''select compressed_column from table where id=12345''')
res = cur.fetchall()
at this point I would like to verify that the entry is compressed (ie in order to work with the data you would have to use select uncompress(compressed_column)..). Ideas?
is there a way to have a mysql select statement return fully qualified column names like "table.field" without using AS for every single field?
like so:
SELECT *
FROM table1
LEFT JOIN table2 on table1.f_ID = table2.ID
and the result would be:
"table1.ID", "table1.name", "table2.ID", "table2.name", ...
Is it possible to assign php array in MySQL IN() function? for example,
$numbers = array('8001254656','8886953265','88864357445','80021536245');
$sql = mysql_query("SELECT * FROM `number_table` WHERE `number` IN ($numbers)");
Any Ideas?
Thanks,
My current process for debugging stored procedures is very simple. I create a table called "debug" where I insert variable values from the stored procedure as it runs. This allows me to see the value of any variable at a given point in the script, but is this is there a better way to debug MySQL stored procedures?
I was trying to run the following query
UPDATE blog_post SET `thumbnail_present`=0, `thumbnail_size`=0, `thumbnail_data`=''
WHERE `blog_post` NOT IN (
SELECT `blog_post`
FROM blog_post
ORDER BY `blog_post` DESC
LIMIT 10)
But Mysql doesn't allow 'LIMIT' in an 'IN' subquery.
I think I can make a select to count the table rows and then make an ordered update limited by 'COUNT - 10', but I was wondering if there is a better way.
Thanks in advance.