Posts by Robson Junior • 79 points
6 posts
-
0
votes0
answers28
viewsQ: Restore database in sql server 2008 R2
I have a file . Bak and while trying to restore I am using the following command: use [master] RESTORE DATABASE Teste FROM DISK='C:\Teste.BAK' But sql returns me the following message: Msg 3241,…
-
1
votes3
answers121
viewsQ: MAX() returning multiple lines
When running the script the same returns not only the maximum value, that is, the longest time, but the 3 times. SELECT P.CD_PACIENTE CD_PACIENTE ,P.NM_PACIENTE NM_PACIENTE ,L.CD_UNID_INT…
-
1
votes1
answer35
viewsQ: return only to your last move of each code
A table records the movement of items by item code, date and time of movement. So the presentation is as follows: CD_Item | DT_Mov 15 10/04/2018 08:52:36 15 21/05/2018 09:32:10 15 20/05/2018…
sqlasked Robson Junior 79 -
0
votes3
answers475
viewsQ: Reverse SQL ordering
Code sorting of a select can be done in reverse? Example: As the last number of the first element is less it comes first and for tiebreaker criterion the second seventeen will be checked, just as in…
sqlasked Robson Junior 79 -
1
votes1
answer296
viewsA: Select returns 2 rows per GROUP BY account
Reply, based on @Andrey’s comment. By making the subselect it was possible to return the expected result. Follow below the corrected code. SELECT DATA_AGENDA, EMPRESA, CD_UNID_ATENDIMENTO,…
-
2
votes1
answer296
viewsQ: Select returns 2 rows per GROUP BY account
The code below returns the number of marked and the number of served, but when adding the CASE to bring me the amount of absences it separates the line of attendees from the line of the defaulters,…