sql-join

SQL join on many queries

Hi, I have a table with a structure such as table(PK, a, b, c, d, e, f, g). And I have many queries that I want to join: select PK, sum(c) where... JOIN select PK, sum(e) where... JOIN select PK, sum(g) where ... JOIN select PK,a,b,d,f Every sum(c|e|g) is actually a select sum(c|e|g) from .... where... because there are m...

Updating joined queries with ADO

Hi I have a select query that joins 3 tables to display information. If I want to update a field is do ADOQuery.Edit. <Set fields Values> ADOQuery.Post. I get the following error howwever 'Insufficient key column information for updating or refresing' and I'm not sure how to proceed. Thank you. Pieter ...

How to do a join that removes values?

Customers Holidays id | name customer_id | start | end ---+------ ------------+--------+------ 1 | Peter 1 | 5 | 10 2 | Simon 1 | 15 | 20 3 | Mary 2 | 5 | 20 What's a working SQL query that gives me all customers without ho...

SQL Joins Excluding Data

Say I have three tables: Fruit (Table 1) ------ Apple Orange Pear Banana Produce Store A (Table 2 - 2 columns: Fruit for sale => Price) ------------------------- Apple => 1.00 Orange => 1.50 Pear => 2.00 Produce Store B (Table 3 - 2 columns: Fruit for sale => Price) ------------------------ Apple => 1.10 Pear => 2.50 Banana => 1.00 ...

Fetch last item in a category that fits specific criteria

Let's assume I have a database with two tables: categories and articles. Every article belongs to a category. Now, let's assume I want to fetch the latest article of each category that fits a specific criteria (read: the article does). If it weren't for that extra criteria, I could just add a column called last_article_id or something s...

how to Solve the "Digg" problem in MongoDB

A while back,a Digg developer had posted this blog ,"http://about.digg.com/blog/looking-future-cassandra", where the he described one of the issues that were not optimally solved in MySQL. This was cited as one of the reasons for their move to Cassandra. I have been playing with MongoDB and I would like to understand how to impleme...

Problem with duplicates in a SQL Join

I have the following result set from a join of three tables, an articles table, a products table, an articles to products mapping table. I would like to have the results with duplicates removed similar to a select distinct on content id. Current result set: [ContendId] [Title] [productId] 1 article one 2 1 ...

Complex SQL Join help!

(For a quick recap please see sections titled , DATA. Can only get results in FIGURE A, and FIGURE B, what I want is DESIRED RESULTS, tried everything posted in the answers section.) All, I have been working hard to start smartly using joins in my application. Boy it took me a while but I think I am getting the hang of this, but I can't...

Difference between JOIN and OUTER JOIN in MySQL

What is result difference between: RIGHT JOIN and RIGHT OUTER JOIN LEFT JOIN and LEFT OUTER JOIN ? Can you please explain through the examples ? ...