Forum: MySQL Oct 8th, 2009 |
| Replies: 2 Views: 405 Try this
Select a,b,c,d,e,f from
(
(SELECT a, b, c, d, e, f, DATE
FROM table1 WHERE a=10 AND b=1)
UNION
(SELECT a, b, c, d, e, f, DATE
FROM table1 WHERE a=11 AND b=1) |
Forum: MySQL Aug 10th, 2009 |
| Replies: 3 Views: 398 Glad I could help. Can you mark the thread solved if your problem has been fixed.
Thanks. |
Forum: MySQL Aug 7th, 2009 |
| Replies: 3 Views: 398 The first thing you need to do is replace the left join with an Inner join. Right now you are joining all the customers even if they do not have any orders which is a waste of resources when you are... |
Forum: MySQL Aug 7th, 2009 |
| Replies: 4 Views: 557 I know this thread is a few days old but if you want the top 10 from the combined list you just sort the list after the unions not for each table.
(SELECT * from table_a )
union (SELECT * FROM... |
Forum: MySQL Aug 4th, 2009 |
| Replies: 2 Views: 328 I think the best way is the syntax you feel more comfortable with.
I like the old joining syntax using the where clause but alot of people like the new syntax, I believe because of readability... |
Forum: MySQL Jul 23rd, 2009 |
| Replies: 8 Views: 631 Im glad i could atleast point you in the right direction. good luck with the rest. |
Forum: MySQL Jul 21st, 2009 |
| Replies: 8 Views: 631 Try this
SELECT MAKE.MAKE, MAKE.count, color.Color, color.count
FROM(
SELECT MAKE, count(*)count
FROM cars
Group by MAKE
)MAKE,
( SELECT MAKE, color,... |
Forum: MySQL Jul 21st, 2009 |
| Replies: 8 Views: 631 Nevermind, I take it the attachment is the table schema.
Is it important to do it all in one query. What are you using the resultset for because if you do it in one query you will most likely get... |
Forum: MySQL Jul 21st, 2009 |
| Replies: 8 Views: 631 Since you didn't give too much information I thought of a few other interpetations of what you asked.
If field1 is a numeric value you might want the sum of the field grouped by field2
Select... |
Forum: MySQL Jul 21st, 2009 |
| Replies: 8 Views: 631 do you mean something like this
Select field2,count(Field1)
From Table
Group by field2 |
Forum: MySQL Jul 1st, 2009 |
| Replies: 3 Views: 710 Their is no way to control flow with Case in SQL so the easy answer to your question is no it is not possible. |
Forum: MySQL Jun 30th, 2009 |
| Replies: 3 Views: 710 Its an easy search
http://msdn.microsoft.com/en-us/library/ms181765.aspx |