Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MySQL++ - Programming with the C++ API to MySQL
MaxDB - Everything about MaxDB, formerly known as SAP DB
ODBC - ODBC with the MySQL Connector/ODBC driver
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
Update one field with more fields from another table
Getting Identity after INSERT
ERROR 2002: Can 't connect to local MySQL server through socket
mysql test 4 1 fails with the gis test
MySQL Cluster Software
Downgrade Mysql from 4 to 3 23
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Can 't access mysql after kernel upgrade
Executing MySQL Commands From Within C Program
Comparing and writing out BLOBS
Preventing Duplicate Entries
FULLTEXT query format question
Strange behavior, Table Level Permission
Does the binary log enabling affect the MySQL performances?
mysql:it 's a db not a dbms how it 's possible?!
mysql have same function mthod as Oracle decode()
 
Outer join/build-in functions bug

Outer join/build-in functions bug

2007-06-14       - By Vlad Arkhipov

 Back
<mailto:maxdb@(protected)>DROP TABLE GIS2.Invests
/
CREATE TABLE GIS2.Invests(
 ID INTEGER NOT NULL PRIMARY KEY,
 VAL VARCHAR(10) NOT NULL
)
/
DROP TABLE GIS2.Revisions
/
CREATE TABLE GIS2.Revisions(
 INVEST_ID INTEGER,
 TO_DATE DATE,
 FOREIGN KEY (INVEST_ID)
   REFERENCES GIS2.Invests (ID)
)
/
INSERT INTO GIS2.Invests (ID, VAL)
VALUES (1, 'ABC')
/
INSERT INTO GIS2.Invests (ID, VAL)
VALUES (2, 'DEF')
/
INSERT INTO GIS2.Revisions (INVEST_ID, TO_DATE)
VALUES (1, '2000-01-01')
/
INSERT INTO GIS2.Revisions (INVEST_ID, TO_DATE)
VALUES (2, NULL)


SELECT i.VAL, SUBSTR(i.VAL, 1, 1)
FROM GIS2.Invests i,
    GIS2.Revisions r
WHERE i.ID = 2
     AND i.ID = r.INVEST_ID (+)
     AND (r.TO_DATE (+) IS NULL OR r.TO_DATE >= DATE)

VAL     EXPRESSION1  
-- ---  -- ---- ------
DEF     D            

SELECT i.VAL
FROM GIS2.Invests i,
    GIS2.Revisions r
WHERE i.ID = 1
     AND i.ID = r.INVEST_ID (+)
     AND (r.TO_DATE (+) IS NULL OR r.TO_DATE >= DATE)

VAL  
-- ---
ABC  

SELECT i.VAL, SUBSTR(i.VAL, 1, 1)
FROM GIS2.Invests i,
    GIS2.Revisions r
WHERE i.ID = 1
     AND i.ID = r.INVEST_ID (+)
     AND (r.TO_DATE (+) IS NULL OR r.TO_DATE >= DATE)


returns no records. You may change SUBSTR with any other function to get
the same result.

MaxDB 7.6.00.16 - 016-123-109-428


--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/maxdb?unsub=mysql@(protected)