Re: select from two tables when they correspond, otherwise one table

2006-12-21 Thread boll
Thanks, Jocelyn. That's what I was looking for. Jocelyn Fournier wrote: Hi, SELECT products.sku, products.title, products.price, qty_price.qty, qty_price.qprice FROM products LEFT JOIN qty_price ON (products.sku = qty_price.qsku) WHERE products.vendor_id=15 AND products.category='widgets'; s

RE: select from two tables when they correspond, otherwise one table

2006-12-21 Thread Ruan
ecember 21, 2006 9:56 AM To: mysql@lists.mysql.com Subject: select from two tables when they correspond, otherwise one table This query will display from the 'products' and 'qty_price' tables when the 'products.sku' and 'qty_price.qsku' fields match: S

Re: select from two tables when they correspond, otherwise one table

2006-12-21 Thread Jocelyn Fournier
Hi, SELECT products.sku, products.title, products.price, qty_price.qty, qty_price.qprice FROM products LEFT JOIN qty_price ON (products.sku = qty_price.qsku) WHERE products.vendor_id=15 AND products.category='widgets'; should do what you want. Regards, Jocelyn Fournier www.mesdiscussions.

select from two tables when they correspond, otherwise one table

2006-12-21 Thread boll
This query will display from the 'products' and 'qty_price' tables when the 'products.sku' and 'qty_price.qsku' fields match: SELECT products.sku, products.title, products.price, qty_price.qty, qty_price.qprice FROM products, qty_price WHERE products.sku = qty_price.qsku AND products.vendor_id=1

Re: Select from two tables not returning the expected number of rows

2004-10-13 Thread Philippe Poelvoorde
Ted Byrne wrote: you didn't say that (svr,started,ended,volume,who) is a unique key... If not, it would explain the result and the extra rows you get. Well... that combination of fields *should* be unique. Does a unique index need to be specified on those columns? It is possible that (svr,star

Re: Select from two tables not returning the expected number of rows

2004-10-13 Thread Ted Byrne
You didn't even say that (svr, started, ended, volume, who, action) was a unique combination of values for either table. If that is the case then you will have a hard time matching rows of one table uniquely to rows of the other table. Shawn, Sorry for the lack of clarity on my part. The combina

Re: Select from two tables not returning the expected number of rows

2004-10-13 Thread SGreen
Ted, You didn't even say that (svr, started, ended, volume, who, action) was a unique combination of values for either table. If that is the case then you will have a hard time matching rows of one table uniquely to rows of the other table. Try this query and you may be able to see where the

Re: Select from two tables not returning the expected number of rows

2004-10-13 Thread Ted Byrne
you didn't say that (svr,started,ended,volume,who) is a unique key... If not, it would explain the result and the extra rows you get. Well... that combination of fields *should* be unique. Does a unique index need to be specified on those columns? It is possible that (svr,started,ended,volume,

Re: Select from two tables not returning the expected number of rows

2004-10-13 Thread Philippe Poelvoorde
mysql>select count(*) from x.table_a,y.table_b WHERE x.table_a.svr = y.table_b.svr and x.table_a.started = y.table_b.started and x.table_a.ended = y.table_b.ended and x.table_a.volume = y.table_b.volume and x.table_a.who = y.table_b.who; you didn't say that (svr,started,ended,volume,who) is a uniq

Select from two tables not returning the expected number of rows

2004-10-12 Thread Ted Byrne
I'm struggling with this, and am not sure what I'm doing wrong... There are two tables in separate databases that have 6 fields in common. In addition to the six columns in common between table_a and table_b, each table has some additional fields that are not related. Table_a and table_b each

SELECT from two tables with condition

2004-08-26 Thread melter
Hi! I have got two tables: 'item' and 'propertie'. Table 'item' has index column named 'id_propertie' which refers to one row in table 'propertie'. Table 'propertie' has string column 'value'. I want to get the value of colun 'value' from table 'propertie' which index is same than in table 'item

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 `hel

select from two tables #2

2004-03-31 Thread rmck
Hi I have two tables in the same Db : table 1: helpdesk | CREATE TABLE `helpdesk` ( `wcalledname` varchar(50) default NULL, `wcalledphone` varchar(50) default NULL, `wcalledemail` varchar(50) default NULL, `typeof` varchar(50) default NULL, `status` varchar(25) default NULL, `reason

select from two tables

2004-03-31 Thread rmck
Hi I have two tables in the same Db : table 1: helpdesk | CREATE TABLE `helpdesk` ( `wcalledname` varchar(50) default NULL, `wcalledphone` varchar(50) default NULL, `wcalledemail` varchar(50) default NULL, `typeof` varchar(50) default NULL, `status` varchar(25) default NULL, `reason

Re: select from two tables then create a new table

2003-10-20 Thread Roger Baklund
* zhu xiaofeng > Sent: Thursday, October 09, 2003 4:45 AM An old question, but no replies... > There is a question: > Two tables: >table_out: ( fields ) product_name,out_count , out_date >table_in: ( fields ) product_name,in_count , in_date > I want to create

select from two tables then create a new table

2003-10-08 Thread zhu xiaofeng
Hi all: There is a question: Two tables: table_out: ( fields ) product_name,out_count , out_date table_in: ( fields ) product_name,in_count , in_date I want to create a table that show the remain of product. Can you help me?? thanks in advance! -- MySQL G

Help using CREATE Temporary SELECT from two TABLES--Problem now solved

2002-05-24 Thread Andrew Lietzow
Dear MySQL Wizards, I discovered a solution that works to resolve this problem. :-) Here are the steps I took. -- 1. At the O/S, I copied the three MySQL files to a new name, a_copy. 2. I used mySQLman to delete an index and then to recreate it. I did this because the syst