Re: Joins and Unions

2003-08-14 Thread Nils Valentin
Hi Kim, just send a reply a minute ago. I got it now. You want to change the way the data is presented at the screen and thats a different issue. You would have to make this in your apllication, not with mysql itself I believe. You basically want the DISTINCT function within the JOINS - but

Re: Joins and Unions

2003-08-14 Thread Kim Kohen
G'day Jim What about this? That's it, thanks! I'll be fiddling a bit to get a few other columns but so far this seems be be what I want. The only book I have which handles Unions is the MySQL Cookbook (Paul Dubois) and the examples didn't include any 'where' clauses so I didn't realise

RE: Joins and Unions

2003-08-14 Thread Jim Smith
Adtrack - holds data about an ads status (but NOT page number) Dummy - holds data about ad position, geometry and page number Stories - holds data about stories and their page number Pages - holds data about pages and their status I want to be able to display a page and all its associated

Joins and Unions

2003-08-14 Thread Kim Kohen
G'day all, I'm pretty new to MySQL and very new to v4. This is probably going to sound strange, but is it possible to create a union using the logic of a join? I have 4 tables and I need to join data from them, but I'd like to display them like a Union. If I do a straight join, I get lots of

Re: Joins and Unions

2003-08-14 Thread daniel
I have also had this trouble before if there are say 5 results from the second table, the first table of results would be duplicated 5 times on a join, i would also like to know how to get around this. G'day all, I'm pretty new to MySQL and very new to v4. This is probably going to sound

Re: Joins and Unions

2003-08-14 Thread Kim Kohen
G'day Nils no offense, but are you actually using the JOIN syntax correctly ? No offence taken - that's why I'm asking the question - I don't know whether I'm approaching this correctly. As I said, I'm new to MySQL ... Could you post your query please ? OK. Adtrack - holds data

Re: Joins and Unions

2003-08-14 Thread daniel
well i'd like to join tables without duplicates, currently i cannot do this unless i select the category table in a second loop to list all the categories for that particular row/record Hi Daniel and Kim, Isn't product_name product_category product_name product_category product_name

Re: Joins and Unions

2003-08-14 Thread Kim Kohen
G'day Nils Well, I can't speak for Daniel, and I'm not really up on his tables, but I'm not using left joins. The situation I have is not one where I need to display items that don't exist from one table or another. The data I get from a basic join is the _data_ I want - I just can't get it to

Re: Joins and Unions

2003-08-14 Thread Hans van Harten
Kim Kohen wrote: Comparing PageAd_num status stories 14312-T1308 Ad Complete 1-marchingband-A33Placed 14312-T1308 Ad Complete 1-jobs-T33 Placed 14312-T1308 Ad Complete 1-illegalbuild-A32 Placed 1

Re: Joins and Unions

2003-08-14 Thread daniel
he is getting the same problem as me as i explained i use joins left join and inner join SELECT * FROM products p LEFT JOIN product_cat_join pcj ON p.productID=pcj.productID LEFT JOIN product_category pc ON pc.catID=pcj.catID; products productID product product_cat_join joinID productID catID

Re: Joins and Unions

2003-08-14 Thread Nils Valentin
Hi Daniel and Kim, Isn't product_name product_category product_name product_category product_name product_category product_name product_category product_name product_category the way its supposed to be ? You are using the LEFT JOIN syntax, but actually using it just as a JOIN. You could

Re: Joins and Unions

2003-08-14 Thread Nils Valentin
Hi Daniel, I am still not sure what exactly you are trying to achieve. If you specify the WHERE condition correctly (or ON or USING for the LEFT JOIN) then there is no duplicate entry. I believe what you are asking has more to do with the way how to present the data in the output. Best

Re: Joins and Unions

2003-08-14 Thread Kim Kohen
G'day Nils just send a reply a minute ago. I got it now. You want to change the way the data is presented at the screen and thats a different issue. You would have to make this in your apllication, not with mysql itself I believe. You basically want the DISTINCT function within the JOINS -

Re: Joins and Unions

2003-08-14 Thread Nils Valentin
Hi Kim, You can create a temporary table by using a table alias. The temporary table will only be accessable by the current connection. Any other connection will not be able to use it. If you want to make a table which can be used by several connections (f.e for a join) you could create a

Re: Joins and Unions

2003-08-14 Thread daniel
how can it be confusing ? nobody ever experienced it before? simply when you join 2 tables together if you get 5 records from the second table the first table will display 5 times aswell Hi Daniel, I am still not sure what exactly you are trying to achieve. If you specify the WHERE

Re: Joins and Unions

2003-08-14 Thread Nils Valentin
Hi Kim, no offense, but are you actually using the JOIN syntax correctly ? Could you post your query please ? My guess is you are doing a JOIN without any set conditions. hat would give you the result as described (which is normal). You would use the WHERE clause or for a LEFT JOIN ...the ON