Re: Milliseconds to date string

2004-11-15 Thread Johan Hook
Hi Rafal, binary is a reserved word, you need to quote it with back-ticks ` if you want to use it: SELECT s2u.valus as `binary` FROM ... /Johan Rafal Kedziorski wrote: Hi, I get this: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the

Re: Maximum row size for MyISAM table type

2004-11-12 Thread Johan Hook
Hi Joshua, the BLOB or TEXT is stored separately from the row. What is stored is a pointer to where the BLOB/TEXT is located. /Johan Joshua Beall wrote: Hi All, I am a bit confused by the MySQL documentation on this subject. From http://dev.mysql.com/doc/mysql/en/Storage_requirements.html The

Re: PRODUCT() function - calculating the product of grouped numeric values

2004-08-31 Thread Johan Hook
Hi, you might take a look at this thread: http://lists.mysql.com/mysql/166184 /Johan Hi, I'm searching for a function that enables me to calculate the product of a group of values, like SUM() does. MySQL server version is at least 4.0.14. For example, a query like SELECT id, PRODUCT(value) AS

Re: Select non-matching rows

2004-08-20 Thread Johan Hook
Hi, you could try: SELECT tbl1.id FROM tbl1 LEFT JOIN tbl2 ON tbl2.another_id = tbl1.id WHERE tbl2.id IS NULL /Johan Manish wrote: This should be simple but I am stuck here. I need to select rows from table 1, which do not have matching ID in table 2. Say each table has 100 rows each, and 90 rows

Re: Group Query

2004-06-22 Thread Johan Hook
Shaun, when you add WHERE B.Project_ID = '10' you, in a way, change your LEFT JOIN to an INNER JOIN. You need to do it like: LEFT OUTER JOIN Bookings B ON U.User_ID = B.Rep_ID AND B.Project_ID = '8' /Johan shaun thornburgh wrote: Thanks for your reply, This works great, but when I add a

Re: Group Query

2004-06-18 Thread Johan Hook
Hi, you can use: SELECT COUNT(B.Booking_ID), User_Location FROM Users U LEFT JOIN Bookings B ON U.User_ID = B.User_ID GROUP BY(U.User_Location); /Johan shaun thornburgh wrote: Hi, The following table produces a query that shows all bookings that user has made and groups the number of bookings by

Re: Using IF

2004-06-11 Thread Johan Hook
Hi Keith, I think your problem comes down to the fact that IF() is a function that must return one value, when you put in your '*' you might be specifying more then one value to return. /Johan Keith wrote: g'day, Am having a bit of a problem with using IF. This is the error message I get: -

Re: (might be off list) MySQL AB

2004-06-10 Thread Johan Hook
stand for? Is it something like limited or incorporated? If yes, is this something related to the origin of MySQL? I am a subscriber from Hong Kong. Thanks. mc. -- Johan Hook, Pythagoras Engineering Group - MailTo:[EMAIL PROTECTED] - http

Re: ORDER BY Question

2004-05-13 Thread Johan Hook
Hi Dirk, from the excellent on-line manual: http://dev.mysql.com/doc/mysql/en/SELECT.html Columns selected for output can be referred to in ORDER BY and GROUP BY clauses using column names, column aliases, or column positions. Column positions are integers and begin with 1: mysql SELECT

Re: ORDER BY Question

2004-05-12 Thread Johan Hook
Hi Dirk, you should be able to just add on ORDER BY Count after your groub clause. /Johan Dirk Bremer (NISC) wrote: The following query produces the following results: select job_coop as 'Job/Coop', count(*) as Count from queue group by job_coop; -- snip Is there a way to use the ORDER BY

Re: first LIMIT then ORDER

2004-04-22 Thread Johan Hook
Assuming you want to order your arbitrary selection you could do something like: (SELECT t.Id FROM tab t LIMIT 10) UNION ALL (SELECT t.Id FROM tab t WHERE 1 0) ORDER BY t.Id /Johan Harald Fuchs wrote: In article [EMAIL PROTECTED], Paul DuBois [EMAIL PROTECTED] writes: At 18:51 +0200 4/21/04,

Re: What Is LIMIT? and How to Use LIMIT?

2004-04-01 Thread Johan Hook
Hi, I guess this is for a java.sql.PreparedStatement as the '?' seem to indicate that. LIMIT limits ;-) the number of rows retrieved, i.e. LIMIT 10, 20 gives you 20 rows starting at row 20 in the resultset and LIMIT 10 gives you the first 10 rows. See: http://www.mysql.com/doc/en/SELECT.html

Re: select from two tables

2004-03-31 Thread Johan Hook
Hi, if you are using 4.x or later you can use: (select * from helpdesk where month(helpdesk.hdcreatedate) = 3) UNION ALL (select * from archived where month(archived.hdcreatedate) = 3) LIMIT 0, 30; /Johan rmck wrote: Hi I have two tables in the same Db : table 1: helpdesk | CREATE TABLE

Re: insert field from another table

2004-03-24 Thread Johan Hook
Hi, you could try something like: INSERT INTO articles_multi(article,author,text_ru,text_en ) SELECT e.article,e.authoer,r.text,e.text FROM articles_en e, articles_ru r WHERE e.article = r.article AND e.author = r.article /Johan nullevent wrote: Hello mysql, I have two tables -

Re: Using OR

2004-03-12 Thread Johan Hook
Hi Keith, you can use: pla.type IN ('1','2','3','4'); /Johan Keith wrote: is there any alternative to using OR for selecting between values? ie: pla.type='1' OR pla.type='2' OR pla.type='3' OR pla.type='4' Cheers, Keith -- Johan Höök, Pythagoras Engineering Group -

Re: Newbie: Rewriting A Query- How?

2004-03-09 Thread Johan Hook
Hi Ken, you might try: SELECT s.PROJID,s.PROJECTNAME FROM S_PROJECTREGISTER s INNER JOIN SL_PROGPROJ l ON s.PROJID = l.PROJID AND l.SNAPSHOTID = 56 INNER JOIN SL_PORTPROG p ON l.PROGID = p.PROGID AND p.SNAPSHOTID = 56 AND p.PORTID IN (100994,100996) WHERE s.SNAPSHOTID = 56 AND

Re: Newbie query question...

2004-02-04 Thread Johan Hook
Hi John, I think you missed on the precedence of AND/OR if you change to AND (cat_id='2' OR cat_id='5' ) it should work as you want it to /Johan John Croson wrote: I have a simple query: SELECT id,year,month,day,cat_id FROM events LEFT JOIN calendar_cat ON events.cat=calendar_cat.cat_id WHERE

Re: inser woes

2004-01-12 Thread Johan Hook
Hi Doug, I think you need to quote imgsml=C2BUWS1028.jpg, like imgsml='C2BUWS1028.jpg', take care, /Johan [EMAIL PROTECTED] wrote: This has to be something silly, but I can not see it. Any help greatly appreciated: use newshop; insert into products set storeid=2, deptid=5, groupid=66,