Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
gonso75
Starting Member
3 Posts |
Posted - 2009-06-12 : 05:36:54
|
| HiIm trying to create a rather complicated query and Im looking for asistance.I have 2 tables A-B-C and I want to get all records from A that are related with B-C where a condition is met in C AND all of those that are not included in B.I have two queries like this:a) first querySELECT *FROM A, B, CWHERE B.A_ID = A.IDAND B.C_ID = C.IDAND C.c_date > '2009-05-01 23:59:59'b) second querySELECT *FROM AWHERE A.ID NOT IN (SELECT DISTINCT B.A_ID)I would like to mix both queries and I dont know how.I have tried UNION but table A has some float fields and when I do the join that column goes crazy with decimal values:0.3 appears as 0.300000011920929I gues a left Join of shorts could work... but I cant figure it out.Any help?Thanks!Gonso |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-12 : 05:46:45
|
Are you using FLOAT datatype? E 12°55'05.63"N 56°04'39.26" |
 |
|
|
gonso75
Starting Member
3 Posts |
Posted - 2009-06-12 : 05:53:03
|
quote: Originally posted by Peso Are you using FLOAT datatype? E 12°55'05.63"N 56°04'39.26"
Right, its a field defined as float(9,3) in MySQL and Im actually doing some multiplications on it.... |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-12 : 05:57:13
|
You are using MySQL?This is a Microsoft SQL Server forum, if you haven't noticed it.If you have a MySQL question, please ask over at www.dbforums.com for better answers. They have a MySQL dedicated forum. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
gonso75
Starting Member
3 Posts |
Posted - 2009-06-12 : 06:49:21
|
quote: Originally posted by Peso You are using MySQL?This is a Microsoft SQL Server forum, if you haven't noticed it.If you have a MySQL question, please ask over at www.dbforums.com for better answers. They have a MySQL dedicated forum. E 12°55'05.63"N 56°04'39.26"
Even though Im using a MySql this is really a SQL query languange question... but if its not welcome..... |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2009-06-12 : 07:11:42
|
You are right it's a SQL language, but the different vendors do have different "dialects" in their SQL-language implementation.What if we make a MS SQL specific suggestion, then we have to do it all over again because our suggestion doesn't compile in MySQL. E 12°55'05.63"N 56°04'39.26" |
 |
|
|
|
|
|