how to run a file in MySQL
Hello all, This is probably really basic for all of you but I have been trying to find it in the manual without success... My question is if it is possible when you are logged in to MySQL to run a file with sql-statements in, instead of sit and execute each statement seperatly. The file I have is a to clean up my DB and to erase data that I don#t want to have, som all rows in the file is normal DELETE-statetments. Thanks in advance! /Joppe -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
error message when creating tables
Hello all, I have a problem with a script I have made, it always stops when it tries to creat a special table, I have been comparing this part of the script with the other parts that is working and cand find anything that looks wrong... The message MySQL write is: Can't create table './test_db/BOUNCE_MAILS.frm' (errno: 150) What does errno: 150 means? I have checked and mysql are allowed to write in the specific catalog... Have any a clue? /Joppe -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
problems...
Hello all, I have I small problem I wonder if there is a easy solution for.. I have a SQL-query where I count out how many users per "n_id" I have. it is a little tricky because I had to do a left joint and compare two tables to get out thoose that are represented only in one of the tables. SELECT SUBS.NE_ID, count(*) from SUBS left join SUB on SUBS.SC_ID=SUB.SC_ID WHERE SUB.SC_ID is NULL group by SUBS.NE_ID; The result I get out looks like this NE_ID count 01 10 02 11 03 4 04 8 And now to my problem, I would like to count this together with another table I have instead of have a seperate query and count them together manually... SELECT count(*) from SUBS_DEAC where NE_ID=01 I want to have these extra query added in my first query and get out the result as above (but now are SUBS and SUBS_DEAC counted together) I can also mention that my MySQL db is version 3.23.55. Unfortunatly is no update to newer version at the moment planed... Would be greatfull to get some help! /Joppe -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Fwd: how can I do instead of using subselects?
Please help, this must be easy for experinced MySQL users but for me as a newbie isn't it. I have tried to find the answer on the things below in older MySQL manuals but without any success... I have a problem with a few sql-queries because I have written the questions with subselect statements and then will they not work on older MySQL DB:s. Can any one help me to say haw to solve it without subselect! Today looks the questions like this and works fine in MySQL 4.x.x but not in 3.23.55 where I also need to use them: SELECT (SELECT count(SUB.S_ID) FROM SUB LEFT JOIN SUBS ON SUBS.S_ID = SUB.S_ID) /(SELECT COUNT(*) from SUB); SELECT COUNT(SUBS.NEW_ID)+(SELECT COUNT(SUBS_D.NEW_ID) FROM SUBS_D WHERE SUBS.NEW_ID=SUBS_D.NEW_ID) FROM SUBS WHERE SUBS.NEW_ID=1; SELECT (SELECT count(*) from SUBS)-(SELECT count(SUBS.S_ID) FROM SUB LEFT JOIN SUBS ON SUBS.S_ID = SUB.S_ID)+(SELECT count(*) FROM SUBS_D); Another question is how do I do when I want to compare two tables, normally is it no problem to get a list with rows that exist i both tables, but how do I do if I want to to have the diffrence listed instead, the rows that only appears in one of the tables? Thanks in advance! /Joppe -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
how can I do instead of using subselects?
Hello everyone, I have a problem with a few sql-queries because I have written the questions with subselect statements and then will they not work on older MySQL DB:s. Can any one help me to say haw to solve it without subselect! Today looks the questions like this: SELECT (SELECT count(SUB.S_ID) FROM SUB LEFT JOIN SUBS ON SUBS.S_ID = SUB.S_ID) /(SELECT COUNT(*) from SUB); SELECT COUNT(SUBS.NEW_ID)+(SELECT COUNT(SUBS_D.NEW_ID) FROM SUBS_D WHERE SUBS.NEW_ID=SUBS_D.NEW_ID) FROM SUBS WHERE SUBS.NEW_ID=1; SELECT (SELECT count(*) from SUBS)-(SELECT count(SUBS.S_ID) FROM SUB LEFT JOIN SUBS ON SUBS.S_ID = SUB.S_ID)+(SELECT count(*) FROM SUBS_D); Another question is how do I do when I want to compare two tables, normally is it no problem to get a list with rows that exist i both tables, but how do I do if I want to to have the diffrence listed instead, the rows that only appears in one of the tables? Thanks in advance! /Joppe -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: SQL problem
Sorry, I have missed information in my earlir question, that I have added below. > Joppe A wrote: > > Hello all, Please help a newbie ;-) Have a little problem with to > make a sql-query as I want to have it... The problem is I need to > check in 3 tables and count out and get it presentated per "n_id" > like > > n_id counted > 015 > 0210 > 032 > > My tables look as follows... > > In sub: > id > n_id > > In us: > id > email > > In sub_del: > n_id > id > > My problem is that I want to be able to get out the result per > sub.n_id and that I have to count it together, and se the result per n_id. > > I have since earlier a query that check the total sum of it, but that is not > enough... > > SELECT (SELECT count(sub_id) from sub) - (SELECT count(us.id) FROM us LEFT > JOIN sub ON sub.id = us.id)+(SELECT count(*) FROM sub_del); > > As you can see I have to count all id in my sub-table and then minus the id > from US-table and then add what I have in sub_del-table, and listed pro n-id > instead of only get the total sum. > Please help! > > /Joppe -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
SQL problem
Hello all, Please help a newbe ;-) Have a little problem with to make a sql-query as I want to have it... The problem is I need to check in 3 tables and count out and get it presentated per "n_id" like n_id counted 01 5 02 10 03 2 My tables look as follows... In sub: id n_id In us: id email In sub_del: n_id id My problem is that I want to be able to get out the result per sub.n_id. Please help! /Joppe -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
SQL-Query problem
Hello all, Have a little problem with to make a sql-query as I want to have it... The problem is I need to check in 3 tables and count out and get it presentated per "n_id" like n_id counted 01 5 02 10 03 2 My tables look as follows... In sub: id n_id In us: id email In sub_del: n_id id I have already a query that count it out totally. SELECT (SELECT count(sub_id) from sub) - (SELECT count(us.id) FROM us LEFT JOIN sub ON sub.id = us.id)+(SELECT count(*) FROM sub_del); But my problem is that I want to be able to get out the result per sub.n_id instaead. Please help! /Joppe -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
how to make question that check...
The following statement helped Roger Backlund me with a few days ago, It works great but now I need to make it more advance and I don#t get any where to find the right solution.. SELECT COUNT(created) from SUBSCRIBER where date_format( date_sub(now(), interval 1 day), '%Y%m%d%H%i%s') <= created; the db-table (table name is SUBSCRIBER) have the following columns as follows: ID email created updated 001 [EMAIL PROTECTED] 20050215131034 20050215133401 063 [EMAIL PROTECTED] 20050215141034 20050215141201 076 [EMAIL PROTECTED] 20050215134500 20050215134556 The other table is called SUBSCRIPTIONS and look like following ID sys_id 001 1 063 2 076 3 The data type of the columns are: ID =VARCHAR(14) email =VARCHAR(255) created =VARCHAR(14) updated =VARCHAR(14) sys_id =VARCHAR(14) What I want to do is to be able to check the last hours new rows for a specific sys_id , (not list) only to get out how many rows that have been added... Thanks! -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
How to make so I only need to specify the id once..
Hello, I have a small problem that is probably easy to fix but it is to advanced for me as a "newbe". In my sql-query (below) have I the ID specified twice, I wonder if there is a easy way to solve it so I only need to write my ID once in the query? SELECT (SELECT COUNT(*) FROM subs WHERE id=1) + (SELECT COUNT(*) FROM subs_erased WHERE id=1); Thanks in advance! -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Subquery problems
hello all, I am a newbe working with MySQL. I have a problem that I can't figure out how to do. I have 2 tables that I want to take out data from, the tables looks like below. tableA == ID VARCHAR(12) NAMEVARCHAR(255) CREATED TIMESTAMP tableB == USER_ID VARCHAR(12) ID VARCHAR(12) SUB_DATETIMESTAMP CREATED TIMESTAMP Okay here is how it looks in them. tableA ID NAMECREATED 01 boat20050117103245 02 car 20050213133418 03 mc 20050214015902 04 bike20050217081232 tableB USER_ID ID SUB_DATECREATED 100002 20050214135412 20050213133418 100104 20050215143410 20050213124415 100204 20050213133418 20050214133418 100303 20050213133418 20050213133418 Now to my problem, I want to get out the ID,NAME from tableA and then from tableB get the "count" of how many that that choosen the specific alternative in the ID column. The problem is also that I only want to specify the ID once in the sql-question. My answer I want to have from my question should be something like this: 01 boat 0 02 car 1 03 mc 1 04 bike 2 Would be greatful if somebody could help! -- ___ Sign-up for Ads Free at Mail.com http://promo.mail.com/adsfreejump.htm -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]