Click here to Skip to main content
15,914,447 members
Home / Discussions / Database
   

Database

 
GeneralRe: picture box binding problem Pin
Dan_P2-May-05 15:45
Dan_P2-May-05 15:45 
GeneralRe: picture box binding problem Pin
Binary01102-May-05 18:18
Binary01102-May-05 18:18 
GeneralRe: picture box binding problem Pin
Michael Potter3-May-05 8:54
Michael Potter3-May-05 8:54 
GeneralRe: picture box binding problem Pin
Binary01103-May-05 15:22
Binary01103-May-05 15:22 
GeneralSELECT COUNT into a variable Pin
Luis Alonso Ramos2-May-05 8:10
Luis Alonso Ramos2-May-05 8:10 
GeneralRe: SELECT COUNT into a variable Pin
Christian Graus2-May-05 14:07
protectorChristian Graus2-May-05 14:07 
GeneralRe: SELECT COUNT into a variable Pin
Luis Alonso Ramos2-May-05 14:15
Luis Alonso Ramos2-May-05 14:15 
GeneralRe: SELECT COUNT into a variable Pin
Colin Angus Mackay2-May-05 20:03
Colin Angus Mackay2-May-05 20:03 
Luis Alonso Ramos wrote:
GROUP BY ID_recibo HAVING (ID_recibo = @ID_recibo);

This looks a bit odd to me. When looking for a single return value with an aggregate I've never used a GROUP BY because that is likely to return multiple values. Of course, the HAVING clause will reduce that back to one or zero results.

It would be better to say:
SELECT @@Cuenta = COUNT(*) 
FROM Recibos_Reimpresiones 
WHERE ID_recibo = @ID_recibo
because this is guaranteed to return exactly one result every time, even if there are no records. This would mean that you could get rid of your IF statement that checks if @Cuenta is NULL

Does this help?


My: Blog | Photos | Next SQL Presentation
WDevs.com - Open Source Code Hosting, Blogs, FTP, Mail and More


GeneralRe: SELECT COUNT into a variable Pin
Luis Alonso Ramos2-May-05 20:52
Luis Alonso Ramos2-May-05 20:52 
GeneralRe: SELECT COUNT into a variable Pin
Colin Angus Mackay2-May-05 22:32
Colin Angus Mackay2-May-05 22:32 
Generalinstall mysql Pin
Anonymous2-May-05 5:52
Anonymous2-May-05 5:52 
GeneralSimple JOIN in Access 2002 Pin
Larsenal1-May-05 13:30
Larsenal1-May-05 13:30 
GeneralRe: Simple JOIN in Access 2002 Pin
turbochimp2-May-05 2:35
turbochimp2-May-05 2:35 
GeneralRe: Simple JOIN in Access 2002 Pin
Larsenal2-May-05 8:00
Larsenal2-May-05 8:00 
QuestionHow to compare time Pin
Leelanga30-Apr-05 22:13
Leelanga30-Apr-05 22:13 
AnswerRe: How to compare time Pin
Alexey A Abramov3-May-05 9:09
Alexey A Abramov3-May-05 9:09 
GeneralRe: How to compare time Pin
Leelanga4-May-05 5:49
Leelanga4-May-05 5:49 
QuestionPossible to pass table as parametr to stored procedure??? Pin
_J_30-Apr-05 8:28
_J_30-Apr-05 8:28 
AnswerRe: Possible to pass table as parametr to stored procedure??? Pin
NewSilence30-Apr-05 18:52
NewSilence30-Apr-05 18:52 
GeneralRe: Possible to pass table as parametr to stored procedure??? Pin
_J_30-Apr-05 22:02
_J_30-Apr-05 22:02 
Questionhow to efficiently use dataset in large database? Pin
feyang30-Apr-05 2:24
feyang30-Apr-05 2:24 
AnswerRe: how to efficiently use dataset in large database? Pin
Colin Angus Mackay30-Apr-05 10:27
Colin Angus Mackay30-Apr-05 10:27 
GeneralBegineer 's questions:using ADO Pin
brilliant10129-Apr-05 20:40
brilliant10129-Apr-05 20:40 
GeneralSQL Query Problem. Pin
Asim N.29-Apr-05 16:23
Asim N.29-Apr-05 16:23 
GeneralRe: SQL Query Problem. Pin
Colin Angus Mackay30-Apr-05 0:48
Colin Angus Mackay30-Apr-05 0:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.