RE: Trouble with LEFT JOIN

2015-09-25 Thread Adrian Beech
Hi There, If I interpreted what you are trying to do is to return all the rows from Challenge and reference Patrocinio excluding those rows in Patrocinio where PTRN_ID is 1? Not sure if the below is possible in MySQL but I've used this in other places when doing a left join and needi

Re: Trouble with LEFT JOIN

2015-09-25 Thread Richard Reina
3 | 2.00 | >>> | 3 | 3 | 6 | 1.00 | >>> ++---+-+----+ >>> I would like to select all rows from challenges which are NOT linked to a >>> patrocinio with the PTRN_

Re: Trouble with LEFT JOIN

2015-09-04 Thread Peter Brawley
2 through 6 of challenges. I am trying to go about this with a LEFT JOIN query but it does not seem to be working for me. mysql> select c.ID FROM challenge c LEFT JOIN patrocinio p ON c.ID=p.CHLNG_ID WHERE p.PTRN_ID!=1; ... where p.chlng_id IS N

Re: Trouble with LEFT JOIN

2015-09-04 Thread Richard Reina
6 | 1.00 | >> ++---+-++ >> I would like to select all rows from challenges which are NOT linked to a >> patrocinio with the PTRN_ID -- which would be rows 2 through 6 of >> challenges. >> >> I a

Re: Trouble with LEFT JOIN

2015-09-04 Thread Peter Brawley
6 | 1.00 | ++---+-++ I would like to select all rows from challenges which are NOT linked to a patrocinio with the PTRN_ID -- which would be rows 2 through 6 of challenges. I am trying to go about this with a LEFT JOIN query but it does not seem

Trouble with LEFT JOIN

2015-09-04 Thread Richard Reina
1.00 | ++---+-++ I would like to select all rows from challenges which are NOT linked to a patrocinio with the PTRN_ID -- which would be rows 2 through 6 of challenges. I am trying to go about this with a LEFT JOIN query but it does not seem to be working for me. mysql> select

Re: Why does a group_concat on a join change aggregate values?

2015-05-09 Thread hsv
On 2015/05/07 19:42, Paul Halliday wrote: Should have showed the whole thing. Take a look here (click image to see full output): http://www.pintumbler.org/tmp I don't see why this worries you. Joining often increases variation. Indeed, if in some case an inner join never did, mayb

Re: Why does a group_concat on a join change aggregate values?

2015-05-07 Thread Paul Halliday
gt;> If I do something like (pseudo): >> >> SELECT count(val) AS n, GROUP_CONCAT(types) AS c_types FROM tbl1 >> >> returns something like: >> >> n c_types >> 1 t9 >> >> when I add a left join though: >> >> SELECT count(val) AS n

Re: Why does a group_concat on a join change aggregate values?

2015-05-07 Thread Bob Eby
First, have you tried GROUP_CONCAT(DISTINCT types) ? Second I see my counts rise just as my group_concat() terms when I do something similar to what you're talking about. Also, here: val c_types d_types 3t9,t9,t9 a2,a3,a9 Your column headers don't seem to match your query.

Re: Why does a group_concat on a join change aggregate values?

2015-05-07 Thread shawn l.green
Hi Paul, On 5/7/2015 10:17 AM, Paul Halliday wrote: Fighting a bit with this one... If I do something like (pseudo): SELECT count(val) AS n, GROUP_CONCAT(types) AS c_types FROM tbl1 returns something like: n c_types 1 t9 when I add a left join though: SELECT count(val) AS n, GROUP_CONCAT

Why does a group_concat on a join change aggregate values?

2015-05-07 Thread Paul Halliday
Fighting a bit with this one... If I do something like (pseudo): SELECT count(val) AS n, GROUP_CONCAT(types) AS c_types FROM tbl1 returns something like: n c_types 1 t9 when I add a left join though: SELECT count(val) AS n, GROUP_CONCAT(types) AS c_types, GROUP_CONCAT(two.types) AS d_types

Re: Join query returning duplicate entries

2013-04-04 Thread shawn green
,p.quantity,p.amount from ac_financialpostings p join (select iac from ims_itemcodes where (cat = 'Male Birds' or cat = 'Female Birds')) i on p.coacode = i.iac where p.trnum like '%02' and p.date between '2012-10-04' and '2013-04-04' order by date Some

Re: Join query returning duplicate entries

2013-04-04 Thread Lucky Wijaya
Hi, sorry i tried to help but i hardly understand the use of join in your query since the joined table is not used anywhere. From: Trimurthy To: mysql@lists.mysql.com Sent: Thursday, 4 April 2013, 14:21 Subject: Join query returning duplicate entries Hi

Re: Join query returning duplicate entries

2013-04-04 Thread Johan De Meersman
- Original Message - > From: "Lucky Wijaya" > To: mysql@lists.mysql.com > Sent: Thursday, 4 April, 2013 10:51:50 AM > Subject: Re: Join query returning duplicate entries > > Hi, sorry i tried to help but i hardly understand the use of join in > your quer

Re: Help with left outer join

2012-12-12 Thread Larry Martell
e_id, ep, wafer_id, lot_id, date_time > > My problem is that when data_cst.image_measurer_id is NULL I don't get > that data_cst row even though all the other part of the where clause > are TRUE. I understand why that is, but in that case I want the row, > but with NULL in the da

Re: Help with left outer join

2012-12-12 Thread Larry Martell
me, ep, wafer_id, lot_id, >date_time, data_file_id, data_cstimage.name, >bottom, wf_file_path_id, data_measparams.name, >vacc, data_category.name > FROM data_cst > RIGHT JOIN data_cstimage ON data_cstimage.id = data_cst.image_measurer_id > INNER JOIN data_tool

Re: Help with left outer join

2012-12-12 Thread Larry Martell
ing example, I would be > trying to match the PK fields of two separate types of data. > > (the USING example) > SELECT ... FROM art INNER JOIN person USING(id)... > > Let's say that I renamed the id fields to art_id and person_id to make them > table-specific. This still fails

Re: Help with left outer join

2012-12-12 Thread Shawn Green
use the pattern _id. It keeps your naming conventions clean and predictable. If I were to try to use a USING operator in my opening example, I would be trying to match the PK fields of two separate types of data. (the USING example) SELECT ... FROM art INNER JOIN person USING(id)... Let'

Re: Help with left outer join

2012-12-11 Thread Peter Brawley
bottom, wf_file_path_id, data_measparams.name, vacc, data_category.name FROM data_cst RIGHT JOIN data_cstimage ON data_cstimage.id = data_cst.image_measurer_id INNER JOIN data_tool ON data_tool.id = data_cst.tool_id INNER JOIN data_target ON data_target.id = data_cst.target_name_id

Re: Help with left outer join

2012-12-11 Thread hsv
t row even though all the other part of the where clause are TRUE. I understand why that is, but in that case I want the row, but with NULL in the data_cstimage.name column. I think I need a left outer join, but I've been messing with this for hours, and I can't get the syntax right. I

Re: Help with left outer join

2012-12-11 Thread Larry Martell
R BY target_name_id, ep, wafer_id, lot_id, date_time > > My problem is that when data_cst.image_measurer_id is NULL I don't get > that data_cst row even though all the other part of the where clause > are TRUE. I understand why that is, but in that case I want the row, > but with NULL in the d

Re: Help with left outer join

2012-12-11 Thread Peter Brawley
all the other part of the where clause are TRUE. I understand why that is, but in that case I want the row, but with NULL in the data_cstimage.name column. Explicit join syntax makes such queries easier to read, write, develop & debug. Is this what you mean? SELECT data_target.name, ep, wafer_

Re: JOIN, JOIN, JOIN

2012-08-22 Thread hsv
>>>> 2012/08/22 17:38 -0400, Shawn Green >>>> MySQL does not have a simple OUTER JOIN command (some RDBMSes call this a FULL OUTER JOIN). What we do have is the option to include the OUTER keyword into our LEFT or RIGHT joins. For example, both of these are acceptable: L

Re: JOIN giving duplicate records

2012-04-04 Thread Hal�sz S�ndor
;>>> 2012/04/03 18:18 +0100, Tompkins Neil >>>> Before sending the table definition, and queries etc, can anyone advise why my query with four INNER JOIN might be give me back duplicate results e.g 100,UK,12121 100,UK,12121 Basically the qu

JOIN giving duplicate records

2012-04-03 Thread Tompkins Neil
Hi Before sending the table definition, and queries etc, can anyone advise why my query with four INNER JOIN might be give me back duplicate results e.g 100,UK,12121 100,UK,12121 Basically the query the statement AND (hotel_facilities.hotelfacilitytype_id = 47 OR

Re: strange select/join/group by with rollup issue....

2012-02-08 Thread Andy Wallace
Thanks, it seems to be working now. I just discovered "WITH ROLLUP". It made me very happy on this project... On 2/8/12 2:54 AM, Arthur Fuller wrote: I'm not sure your method isn't working, but try changing changing the "to date" part to "< '2012-02-08' " and see what you get. HTH, Arthur

Re: strange select/join/group by with rollup issue....

2012-02-08 Thread Arthur Fuller
I'm not sure your method isn't working, but try changing changing the "to date" part to "< '2012-02-08' " and see what you get. HTH, Arthur

strange select/join/group by with rollup issue....

2012-02-07 Thread Andy Wallace
CP_PKG.value AS 'PRODUCT', CP_PKG.value 'PACKAGE', client.active AS 'ACTIVE', client.created AS 'CREATED', count(*) as 'CNT' FROM client JOIN client_profile CP_RCODE ON client.acnt = CP_RCODE.acnt AND CP_R

Re: What is wrong with this outer join?

2011-10-20 Thread Dotan Cohen
On Thu, Oct 20, 2011 at 16:11, Shawn Green (MySQL) wrote: > We do! First though, are you referencing the online documentation or the > packaged documentation? The reason I ask is that the online documentation > does have some user contributions and comments to go along with the text > itself.  Th

Re: What is wrong with this outer join?

2011-10-20 Thread Peter Brawley
On 10/20/2011 9:11 AM, Shawn Green (MySQL) wrote: On 10/19/2011 20:03, Dotan Cohen wrote: ... Thank you Shawn. I very much appreciate your help, and I also appreciate your employer's initiative to have such a position monitoring the mailing list. Is that an Oracle-created position, or did it

Re: What is wrong with this outer join?

2011-10-20 Thread Shawn Green (MySQL)
On 10/19/2011 20:03, Dotan Cohen wrote: ... Thank you Shawn. I very much appreciate your help, and I also appreciate your employer's initiative to have such a position monitoring the mailing list. Is that an Oracle-created position, or did it exist at Sun as well? MySQL has always encouraged

Re: What is wrong with this outer join?

2011-10-19 Thread Hal�sz S�ndor
;>>> 2011/10/19 17:00 +0200, Dotan Cohen >>>> mysql> select * from beers b outer join colours c on (b.colour = c.ID); ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

Re: What is wrong with this outer join?

2011-10-19 Thread Dotan Cohen
On Wed, Oct 19, 2011 at 21:10, Shawn Green (MySQL) wrote: > What you are describing is a FULL OUTER JOIN. This is not supported, yet, in > MySQL.  We only support INNER, NATURAL, LEFT, and RIGHT. > > To simulate a FULL OUTER JOIN, you need to construct a UNION of a LEFT and a >

Re: What is wrong with this outer join?

2011-10-19 Thread Shawn Green (MySQL)
On 10/19/2011 13:19, Dotan Cohen wrote: ... Thank you Shawn! I see that I am getting support right from the top! So far as I understand, an outer join should return all matched and unmatched rows (essentially all rows) from both tables. So it is not clear to me what is the difference between a

Re: What is wrong with this outer join?

2011-10-19 Thread Dotan Cohen
On Wed, Oct 19, 2011 at 18:00, Shawn Green (MySQL) wrote: > This is a simple misunderstanding. From the page you quote, the syntax > patterns for an OUTER join are these: > >  | table_reference {LEFT|RIGHT} [OUTER] JOIN table_reference join_condition > >  | table_reference NA

Re: What is wrong with this outer join?

2011-10-19 Thread Shawn Green (MySQL)
set (0.00 sec) mysql> select * from colours; +++ | id | colour | +++ | 1 | red| | 2 | green | | 3 | blue | +++ 3 rows in set (0.00 sec) mysql> select * from beers inner join colours on beers.colour = c

Re: What is wrong with this outer join?

2011-10-19 Thread Dotan Cohen
On Wed, Oct 19, 2011 at 16:33, Michael Dykman wrote: > Try this.  I sometime get wierd results when I fail to use aliases in a > join.  Also, the parentheses are required. >  - md >  select * from beers b inner join colours c on (b.colour = c.ID); > Thank you Michael. That doe

What is wrong with this outer join?

2011-10-19 Thread Dotan Cohen
olours; +++ | id | colour | +++ | 1 | red| | 2 | green | | 3 | blue | +++ 3 rows in set (0.00 sec) mysql> select * from beers inner join colours on beers.colour = colours.ID; ++---++++ | ID | name | colour | id

In general, cheaper to INNER JOIN or two separate queries

2011-10-03 Thread Dotan Cohen
I need two fields from two different tables. I could either run two queries, or a single INNER JOIN query: $r1=mysql_query("SELECT fruit FROM fruits WHERE userid = 1"); $r2=mysql_query("SELECT beer FROM beers WHERE userid = 1"); --or-- $r=mysql_query("SELECT

Re: Join 2 tables and compare then calculate something

2011-10-02 Thread Anupam Karmarkar
Try out query with UNION also select A,B,C from (select A,B,C from X UNION select A,B,C from Y) group by A,B,C having count(*)>1 From: Gian Karlo C To: mysql@lists.mysql.com Sent: Sunday, 2 October 2011 12:49 PM Subject: Join 2 tables and compare t

Join 2 tables and compare then calculate something

2011-10-02 Thread Gian Karlo C
Hi All, I decided to join and write to the list hoping someone could help and shed a light on me. Here's the scenario. I have a database running in mysql 5.x in Centos 5. The database has 2 tables that is almost identical with some additional fields. Table 1 Name, IPAddress, Description,

Re: Update on inner join - looks good to me, where did I go wrong?

2011-09-10 Thread Dotan Cohen
On Sat, Sep 10, 2011 at 01:48, Carsten Pedersen wrote: > `userTable.userid` => `userTable`.`userid` > Thank you Carsten. That was indeed the problem! Have a peaceful weekend. -- Dotan Cohen http://gibberish.co.il http://what-is-what.com -- MySQL General Mailing List For list archives: http:/

Re: Update on inner join - looks good to me, where did I go wrong?

2011-09-09 Thread Carsten Pedersen
`userTable.userid` => `userTable`.`userid` / Carsten On 09-09-2011 23:01, Dotan Cohen wrote: Now that I've got the syntax right, MySQL is complaining that a field does not exist, which most certainly does: mysql> UPDATE -> `userTable` -> INNER JOIN `anotherTab

Re: Update on inner join - looks good to me, where did I go wrong?

2011-09-09 Thread Dotan Cohen
Now that I've got the syntax right, MySQL is complaining that a field does not exist, which most certainly does: mysql> UPDATE -> `userTable` -> INNER JOIN `anotherTable` -> ON `userTable.userid`=`anotherTable.userid` -> SET `userTable.someField`="

Update on inner join - looks good to me, where did I go wrong?

2011-09-09 Thread Dotan Cohen
I'm trying to update on an join, but I can't find my error: UPDATE `userTable` SET `someField`="Jimmy Page" FROM `userTable` INNER JOIN `anotherTable` ON `userTable.userid`=`anotherTable.userid` WHERE `userTable.someField`="Jim Morrison" AND `anotherTable.dat

RE: Join based upon LIKE

2011-05-05 Thread Jerry Schwartz
>-Original Message- >From: Nuno Tavares [mailto:nuno.tava...@dri.pt] >Sent: Tuesday, May 03, 2011 6:21 PM >To: mysql@lists.mysql.com >Subject: Re: Join based upon LIKE > >Dear Jerry, > >I've been silently following this discussion because I've misse

Re: Join based upon LIKE

2011-05-03 Thread Nuno Tavares
er* a ready solution, because the source is tipically chaotic May I suggest you to explore Google Refine? It seems to be able to address all those issues quite nicely, and the clustering might solve your problem at once. You shall know, however, how to export the tables (or a usable JOIN) as a CSV,

RE: Join based upon LIKE

2011-05-03 Thread Jerry Schwartz
-mail: je...@gii.co.jp Web site: www.the-infoshop.com >-Original Message- >From: shawn wilson [mailto:ag4ve...@gmail.com] >Sent: Tuesday, May 03, 2011 4:08 PM >Cc: mysql mailing list >Subject: Re: Join based upon LIKE > >I'm actually enjoying this discussion beca

Re: Join based upon LIKE

2011-05-03 Thread shawn wilson
I'm actually enjoying this discussion because I have the same type of issue. However, I have done away with trying to do a full text search in favor of making a table with unique fields where all fields should uniquely identify the group. If I get a dupe, I can clean it up. However, like you, they

Re: Join based upon LIKE

2011-05-03 Thread Johan De Meersman
- Original Message - > From: "Jerry Schwartz" > > I'm not sure that I could easily build a dictionary of non-junk > words, since The traditional way is to build a database of junk words. The list tends to be shorter :-) Think and/or/it/the/with/like/... Percentages of mutual and non-

RE: Join based upon LIKE

2011-05-03 Thread Jerry Schwartz
>-Original Message- >From: Johan De Meersman [mailto:vegiv...@tuxera.be] >Sent: Tuesday, May 03, 2011 5:31 AM >To: Jerry Schwartz >Cc: Jim McNeely; mysql mailing list; Johan De Meersman >Subject: Re: Join based upon LIKE > > >http://www.gedpage.com/soundex.html

Re: Join based upon LIKE

2011-05-03 Thread Johan De Meersman
rom: "Jerry Schwartz" > To: "Johan De Meersman" > Cc: "Jim McNeely" , "mysql mailing list" > > Sent: Monday, 2 May, 2011 4:09:36 PM > Subject: RE: Join based upon LIKE > > [JS] I've thought about using soundex(), but I'm not q

RE: Join based upon LIKE

2011-05-02 Thread Jerry Schwartz
>-Original Message- >From: Johan De Meersman [mailto:vegiv...@tuxera.be] >Sent: Sunday, May 01, 2011 4:01 AM >To: Jerry Schwartz >Cc: Jim McNeely; mysql mailing list >Subject: Re: Join based upon LIKE > > >- Original Message - >> From: "Jerry S

Re: Join based upon LIKE

2011-05-01 Thread Johan De Meersman
- Original Message - > From: "Jerry Schwartz" > > I shove those modified titles into a table and do a JOIN ON > `prod_title` LIKE > `wild_title`. Roughly what I meant with the shadow fields, yes - keep your own set of data around :-) I have little more to off

Re: FW: Join based upon LIKE

2011-04-30 Thread Hal�sz S�ndor
2011/04/28 15:28 -0400, Jerry Schwartz No takers? And this is not real taking, because the algorithm of which I am thinking, the edit-distance (Levens(h)tein-distance) algorithm costs too much for you (see the Wikipedia entry), but it yields, I believe, much more nearly such an

Re: FW: Join based upon LIKE

2011-04-29 Thread Hal�sz S�ndor
2011/04/28 15:28 -0400, Jerry Schwartz No takers? And this is not real taking, because the algorithm of which I am thinking, the edit-distance (Levens(h)tein-distance) algorithm costs too much for you (see the Wikipedia entry). The obvious implementation takes as many steps as

RE: Join based upon LIKE

2011-04-29 Thread Jerry Schwartz
>-Original Message- >From: Jim McNeely [mailto:j...@newcenturydata.com] >Sent: Thursday, April 28, 2011 6:43 PM >To: Jerry Schwartz >Subject: Re: Join based upon LIKE > >It just smells wrong, a nicer system would have you joining on ID's of some >kind so tha

RE: Join based upon LIKE

2011-04-29 Thread Jerry Schwartz
>-Original Message- >From: Johan De Meersman [mailto:vegiv...@tuxera.be] >Sent: Friday, April 29, 2011 5:56 AM >To: Jerry Schwartz >Cc: mysql mailing list >Subject: Re: Join based upon LIKE > > >- Original Message - >> From: "Jerry Schwartz&qu

Re: Join based upon LIKE

2011-04-29 Thread Johan De Meersman
- Original Message - > From: "Jerry Schwartz" > > [JS] This isn't the only place I have to deal with fuzzy data. :-( > Discretion prohibits further comment. Heh. What you *really* need, is a LART. Preferably one of the spiked variety. > A full-text index would work if I were only looki

RE: Join based upon LIKE

2011-04-28 Thread Jerry Schwartz
>-Original Message- >From: Johan De Meersman [mailto:vegiv...@tuxera.be] >Sent: Thursday, April 28, 2011 4:18 PM >To: Jerry Schwartz >Cc: mysql mailing list >Subject: Re: Join based upon LIKE > > >- Original Message - >> From: "Jerry Schwartz&q

Re: Join based upon LIKE

2011-04-28 Thread Johan De Meersman
- Original Message - > From: "Jerry Schwartz" > > No takers? Not willingly, no :-p This is a pretty complex problem, as SQL itself isn't particularly well-equipped to deal with fuzzy data. One approach that might work is using a fulltext indexing engine (MySQL's built-in ft indices,

FW: Join based upon LIKE

2011-04-28 Thread Jerry Schwartz
No takers? -Original Message- From: Jerry Schwartz [mailto:je...@gii.co.jp] Sent: Monday, April 25, 2011 2:34 PM To: 'Mailing-List mysql' Subject: Join based upon LIKE I have to match lists of new publications against our database, so that I can replace the existing publicati

Re: left join two tables

2011-04-28 Thread Darryle Steplight
Hi Johan, I think you probably want something like this. Give the following a shot. SELECT * FROM table1 LEFT JOIN table2 ON table1.ID = table2.subID LEFT JOIN table3 ON table1.ID= table3.subID On Thu, Apr 28, 2011 at 9:41 AM, Johan De Meersman wrote: > Hey there, > > - Origina

Re: left join two tables

2011-04-28 Thread Johan De Meersman
Hey there, - Original Message - > From: "Rocio Gomez Escribano" > Hi!! Is it possible to create a left join consult with 2 tables?? > I mean: > SELECT * FROM table1 LEFT JOIN (table2, table3) on table1.ID = > table2.subID and table1.ID= table3.subID Pret

left join two tables

2011-04-28 Thread Rocio Gomez Escribano
Hi!! Is it possible to create a left join consult with 2 tables?? I mean: SELECT * FROM table1 LEFT JOIN (table2, table3) on table1.ID = table2.subID and table1.ID= table3.subID Thanks!!! Rocío Gómez Escribano <mailto:r.sanc...@ingenia-soluciones.com> r.go...@i

Re: LEFT JOIN and WHERE: identical or not and what is better?, etc.

2011-04-26 Thread Hal�sz S�ndor
>>>> 2011/04/26 17:55 +0300, Andre Polykanine >>>> Aha. So, I should write SELECT `Blogs`.* INNER JOIN `Users` ON `Users`.`Id`=`Blogs`.`UserId` instead of my original WHERE clause? Thanks! <<<<<<<< I think so. -- MySQL General Mailin

Re: LEFT JOIN and WHERE: identical or not and what is better?, etc.

2011-04-26 Thread Andre Polykanine
Hello Halбsz, Aha. So, I should write SELECT `Blogs`.* INNER JOIN `Users` ON `Users`.`Id`=`Blogs`.`UserId` instead of my original WHERE clause? Thanks! -- With best regards from Ukraine, Andre Skype: Francophile My blog: http://oire.org/menelion (mostly in Russian) Twitter: http

Re: LEFT JOIN and WHERE: identical or not and what is better?, etc.

2011-04-26 Thread Suresh Kuna
I would go with join rather than where condition. 2011/4/26 Halász Sándor > >>>> 2011/04/25 17:42 +0300, Andre Polykanine >>>> > Here is the first one. > We have two queries: > SELECT `blogs`.* FROM `Blogs` LEFT JOIN `Users` ON > `Blogs`.`Us

Re: LEFT JOIN and WHERE: identical or not and what is better?, etc.

2011-04-26 Thread Hal�sz S�ndor
>>>> 2011/04/25 17:42 +0300, Andre Polykanine >>>> Here is the first one. We have two queries: SELECT `blogs`.* FROM `Blogs` LEFT JOIN `Users` ON `Blogs`.`UserId`=`Users`.`Id`; and the following one: SELECT `Blogs`.* FROM `Blogs`, `Users`

Join based upon LIKE

2011-04-25 Thread Jerry Schwartz
rapeutics%Pipeline Assessment%Market Forecasts to%'); SELECT prod.prod_title AS `Title IN Database`, new_titles.new_title AS `Title IN Feed`, prod.prod_num AS `ID` FROM new_titles JOIN prod ON prod.prod_title LIKE (new_titles.new_title_like) AND prod.pub_id = @PUBID AND pr

Re: LEFT JOIN and WHERE: identical or not and what is better?

2011-04-25 Thread Joerg Bruehe
> questions, please bear with me. > Here is the first one. > We have two queries: > SELECT `blogs`.* FROM `Blogs` LEFT JOIN `Users` ON > `Blogs`.`UserId`=`Users`.`Id`; > and the following one: > SELECT `Blogs`.* FROM `Blogs`, `Users`

Re: LEFT JOIN and WHERE: identical or not and what is better?

2011-04-25 Thread Johnny Withers
The only difference once MySQL parses these two queries is the first one is a LEFT JOIN, which will produce all records from the blogs table even if there is no matching record in the users table. The second query produces an INNER JOIN which means only rows with matching records in both tables

Re: LEFT JOIN and WHERE: identical or not and what is better?

2011-04-25 Thread Jo�o C�ndido de Souza Neto
ing stupid questions, please bear with me. Here is the first one. We have two queries: SELECT `blogs`.* FROM `Blogs` LEFT JOIN `Users` ON `Blogs`.`UserId`=`Users`.`Id`; and the following one: SELECT `Blogs`.* FROM `Blogs`, `Users` WHERE `Blogs`.`UserId`=`

Re: LEFT JOIN and WHERE: identical or not and what is better?

2011-04-25 Thread Mitchell Maltenfort
ut  I  just  start  using some advanced things (earlier I > accomplished  those  tasks  with  PHP),  so  I  will  be asking stupid > questions, please bear with me. > Here is the first one. > We have two queries: > SELECT `blogs`.* FROM     `Blogs`     LEFT     JOIN

LEFT JOIN and WHERE: identical or not and what is better?

2011-04-25 Thread Andre Polykanine
queries: SELECT `blogs`.* FROM `Blogs` LEFT JOIN `Users` ON `Blogs`.`UserId`=`Users`.`Id`; and the following one: SELECT `Blogs`.* FROM `Blogs`, `Users` WHERE `Blogs`.`UserId`=`Users`.`Id`; 1. Are they identical? 2. Which is better (faster, more optimal

Re: Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-25 Thread Kendall Gifford
On Mon, Jan 24, 2011 at 6:43 PM, Gavin Towey wrote: > If you show the EXPLAIN SELECT .. output, and the table structure, someone > will be able to give a more definite answer. > > Thanks for the reply Gavin. I actually did place this info in my very first message on this thread, along with my bas

RE: Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-24 Thread Gavin Towey
server doing simple inner join of two InnoDB tables On Mon, Jan 24, 2011 at 2:20 PM, Kendall Gifford wrote: > > > On Mon, Jan 24, 2011 at 3:40 AM, Joerg Bruehe wrote: > >> Hi everybody! >> >> >> Shawn Green (MySQL) wrote: >> > On 1/21/2011 14:21, Kend

Re: Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-24 Thread Kendall Gifford
rox 2.5 million records) >> >> recipients (approx 6.5 million records) >> >> >> >> [[ ... see the original post for the schema details ... ]] >> >> >> >> >> >> I have the following query that is just too slow: >> >> >

Re: Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-24 Thread Kendall Gifford
for the schema details ... ]] > >> > >> > >> I have the following query that is just too slow: > >> > >>> SELECT messages.* FROM messages > >>> INNER JOIN recipients ON recipients.message_id = messages.id > >>> WHERE recipients.em

Re: Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-24 Thread Joerg Bruehe
st two (InnoDB) tables: >> >> messages (approx 2.5 million records) >> recipients (approx 6.5 million records) >> >> [[ ... see the original post for the schema details ... ]] >> >> >> I have the following query that is just too slow: >> >>

Re: Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-21 Thread Kendall Gifford
+ >> | id | int(10) unsigned | | PRI | NULL| >> auto_increment | >> | message_id | int(10) unsigned | | MUL | 0 >> || >> | employee_id | int(10) unsigned | YES | MUL | NULL >> || >> | ..... OTHER FIELD

Re: Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-21 Thread Shawn Green (MySQL)
s just too slow: SELECT messages.* FROM messages INNER JOIN recipients ON recipients.message_id = messages.id WHERE recipients.employee_id = X GROUP BY messages.id ORDER BY sent_at DESC LIMIT 0, 25; This takes about 44 seconds on average. The query explanatio

Re: Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-21 Thread Reindl Harald
----+----+ > > I have the following query that is just too slow: > >> SELECT messages.* FROM messages >> INNER JOIN recipients ON recipients.message_id = messages.id >> WHERE recipients.employee_id

Slow query on MySQL4 server doing simple inner join of two InnoDB tables

2011-01-21 Thread Kendall Gifford
M messages > INNER JOIN recipients ON recipients.message_id = messages.id > WHERE recipients.employee_id = X > GROUP BY messages.id > ORDER BY sent_at DESC > LIMIT 0, 25; This takes about 44 seconds on average. Th

Re: how to generate a data set then join with in on fly?

2011-01-12 Thread Nuno Tavares
cords-are-ocurring-during-that-interval/ -- Nuno Tavares DRI, Consultoria Informática Telef: +351 936 184 086 Shawn Green (MySQL) escreveu: > On 1/10/2011 18:51, Ryan Liu wrote: >> Hi, >> >> In MySQL, is that possible to generate a data set join with it on fly >> (with

Re: how to generate a data set then join with in on fly?

2011-01-11 Thread Shawn Green (MySQL)
On 1/10/2011 18:51, Ryan Liu wrote: Hi, In MySQL, is that possible to generate a data set join with it on fly (without create an temporary table)? e.g. for a report used by a graphic tool, it requires data in all dates, even it is null. Can I select vacationT.* left join ( all dates d in the

how to generate a data set then join with in on fly?

2011-01-10 Thread Ryan Liu
Hi, In MySQL, is that possible to generate a data set join with it on fly (without create an temporary table)? e.g. for a report used by a graphic tool, it requires data in all dates, even it is null. Can I select vacationT.* left join ( all dates d in the past 3 years) on vacationT.`date

Re: join query for sale report

2010-12-26 Thread bharani kumar
any suggestion, for my question plz On Fri, Dec 24, 2010 at 10:57 PM, bharani kumar < bharanikumariyer...@gmail.com> wrote: > I want to take the sale report, > > Group by catID , > > Daily report , > > table name : tblbasket BID Auto Incre, Prim Key > > BID int(20), BasketSessionID varc

join query for sale report

2010-12-24 Thread bharani kumar
I want to take the sale report, Group by catID , Daily report , table name : tblbasket BID Auto Incre, Prim Key BID int(20), BasketSessionID varchar(100),ProductCode varchar(50), CatID int(10), Quantity int(20), AfterDiscount double,purchasedate datetime, Status int(3) table name

GROUP BY - INNER JOIN and LIMIT - how to get result

2010-11-29 Thread Arkadiusz Malka
I have tables: CREATE TABLE `tblNames` ( ` IdName` int(11) NOT NULL AUTO_INCREMENT, `Name` varchar(60) DEFAULT NULL, PRIMARY KEY (`IdName`), ) ENGINE=MyISAM CREATE TABLE `tblStatusy` ( `IdStatus` int(11) NOT NULL AUTO_INCREMENT, `IdName` int(11) DEFAULT NULL, `Status`

RE: How do I use and JOIN the mysql.time_zone% tables?

2010-10-14 Thread Jerry Schwartz
ww.the-infoshop.com >-Original Message- >From: Daevid Vincent [mailto:dae...@daevid.com] >Sent: Wednesday, October 13, 2010 10:51 PM >To: mysql@lists.mysql.com >Subject: How do I use and JOIN the mysql.time_zone% tables? > >I'm trying to figure out how to join the mys

Re: How do I use and JOIN the mysql.time_zone% tables?

2010-10-13 Thread Johan De Meersman
Part of your answer is the offset column, which seems to be relative to the abbreviation used. This implies, to me, that each particular abbreviation has it's own way of specifying the "starting point" of the time. Added is the DST flag, which (probably) tells you that your app needs to keep daylig

How do I use and JOIN the mysql.time_zone% tables?

2010-10-13 Thread Daevid Vincent
I'm trying to figure out how to join the mysql.time_zone% tables and make sense of this. YES, I know how to "use" them with SET time_zone = timezone; and all that. http://dev.mysql.com/doc/refman/5.0/en/time-zone-support.html That is NOT what I need them for (yet). I have a list

RE: Add "record number" to timestamped router data to facilitate cross join

2010-10-05 Thread Travis Ard
mped router data to facilitate cross join On Fri, Oct 1, 2010 at 12:24 PM, Jake Peavy wrote: > All, > > I have a number of routers which report in with various stats > periodicially. This period is not a regular interval and can drift based on > other factors. Each router drifts in

Re: Add "record number" to timestamped router data to facilitate cross join

2010-10-05 Thread Jake Peavy
t; provide need to be analyzed in terms of deltas between reports (rather than > the absolute number). Therefore I need to perform a cross join to compare > the rows for a given routerID (something like SELECT r1.timestamp, > r2.counter1-r1.counter1 FROM router_data as r1 JOIN router_da

Add "record number" to timestamped router data to facilitate cross join

2010-10-01 Thread Jake Peavy
absolute number). Therefore I need to perform a cross join to compare the rows for a given routerID (something like SELECT r1.timestamp, r2.counter1-r1.counter1 FROM router_data as r1 JOIN router_data as r2 ON (r2.recordNum = r1.recordNum + 1)) Here's an example of some raw data to give y

Re: Conditional join of tow tables

2010-09-07 Thread mysql
Hi Travis Thank you for the hint. i yesterday found the following hint, which I then followed. select t1.datum, t2.sdat. t3.tag from table as t1 left outer join table2 as t2 on t1.datum = t2.sdat left outer join table2 as t3 on dayname(t1.datum) = t3.tag Note: it does not work with inner

RE: Conditional join of tow tables

2010-09-07 Thread Travis Ard
Does this work? select * from t1 join t2 on (t1.datum = t2.sdat or dayname(t1.datum) = t2.tag); -Travis -Original Message- From: mysql [mailto:my...@ayni.com] Sent: Tuesday, September 07, 2010 1:43 AM To: mysql@lists.mysql.com Subject: Conditional join of tow tables Hi listers mysql

Conditional join of tow tables

2010-09-07 Thread mysql
sdat field contains a value which is equivalent to the datum field in the first table (datum = sdat), then this join must be taken and nothing else. Otherwise the more general join via the tag field must be taken (dayname(datum) = tag). I tried to program this using not exists in the on clause

Re: Nested join query?

2010-08-30 Thread Michael Stroh
Travis, Thanks a lot! That seems to work perfectly and also cleans up the syntax a bit so I think it's more understandable. Michael On Aug 30, 2010, at 7:21 PM, Travis Ard wrote: > I think you could do away with your right outer join of table B (which will > include all rows from B

  1   2   3   4   5   6   7   8   9   10   >