1
In a table I have a Date A field in the format 'dd.mm.yyyy'. In another, date field B in the format yyyymmdd
I want to search all fields where date A equals B
1
In a table I have a Date A field in the format 'dd.mm.yyyy'. In another, date field B in the format yyyymmdd
I want to search all fields where date A equals B
1
Try it like this:
SELECT A.*, B.*
FROM TabelaA A, TabelaB B
WHERE B.datab = YEAR(A.dataa) * 10000 + MONTH(A.dataa) * 100 + DAY(A.dataa)
Whereas the fields you want are dataa
table TabelaA
and datab
table TabelaB
.
Thank you very much.
@Julio If this answer solved your problem and you have no questions left, mark it as accepted/correct by clicking on " " on the side, which also marks your question as answered/solved. If on the other hand you are not yet satisfied, leave a comment and we will clarify.
Browser other questions tagged database
You are not signed in. Login or sign up in order to post.
The columns are of what type?
DATE
,DATETIME
,VARCHAR
?– Victor Stafusa
What is the database? Sql Server, Mysql, Oracle ?
– Rafael Marcos
One field is DATA(DD.MM.YY) and the other numerical (YYYYMMDD).
– Julio
the database is SQL
– Julio
Julio, all these databases are SQL. Mysql, Oracle, SQL Server, DB2, Firebird, Mariadb, HSQL, Derby, Postgresql, Sqlite, etc. Which one are you dealing with?
– Victor Stafusa