fil79 Posted June 22, 2010 at 09:51 AM Report #335413 Posted June 22, 2010 at 09:51 AM Boas Estou com um bloqueio, quero ir buscar os registos deste mês a uma tabela que tem o campo data (formato date)... Basicamente: SELECT* from tabela where data= $variável definida previamente que contém o mês Desde já agradeço MCITP-MCTS-MCP
M6 Posted June 22, 2010 at 09:54 AM Report #335415 Posted June 22, 2010 at 09:54 AM Fazes data bewteen (inicio, fim) e metes no inicio o primeiro dia do mês e no fim o último dia do mês. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar."
progster Posted June 22, 2010 at 10:49 AM Report #335431 Posted June 22, 2010 at 10:49 AM ... SELECT* from tabela where data= $variável definida previamente que contém o mês ... O código parece-me ok. ... ... $variável definida previamente que contém o mês ... ... Esta parte é que deve corresponder ao mês em causa definido numa tabela de dados, e não deve estar definida como variavel, mas sim numa tabela de dados Não resolvo dúvidas por PM.
fil79 Posted June 22, 2010 at 11:48 AM Author Report #335441 Posted June 22, 2010 at 11:48 AM usei este sql: SELECT * FROM `tabela` WHERE month( data ) =$variavel ok, obrigado a todos MCITP-MCTS-MCP
M6 Posted June 22, 2010 at 01:41 PM Report #335456 Posted June 22, 2010 at 01:41 PM Tens de ter cuidado com esse código fil79, isso vai apanhar o mês que queres, mas de todos os anos! Se só quiseres o mês do ano actual, isso não funciona. 10 REM Generation 48K! 20 INPUT "URL:", A$ 30 IF A$(1 TO 4) = "HTTP" THEN PRINT "400 Bad Request": GOTO 50 40 PRINT "404 Not Found" 50 PRINT "./M6 @ Portugal a Programar."
progster Posted July 3, 2010 at 08:32 PM Report #337636 Posted July 3, 2010 at 08:32 PM Também tenho a mesma opinião. Não resolvo dúvidas por PM.
Janad0n Posted July 6, 2010 at 09:36 AM Report #337940 Posted July 6, 2010 at 09:36 AM Exato tens que fazer o between do inicio e do fim do mes e assim vai t dar o mes actual
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now