Results 1 to 39 of 39

Thread: [RESOLVED] SQl problem

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Resolved [RESOLVED] SQl problem

    hi all im using this code, and it is working very fine and my reports shows the expected result
    Code:
    If cmb.ListIndex = 1 Then
    Set rs = con.Execute("select marks from StuMarks where srollno=21")
    Set DataReport1.DataSource = rs
    DataReport1.Show
    End If
    but i have to change the to this one
    Code:
    Set rs = con.Execute("select MAX(marks) from StuMarks where srollno=21")
    this is not working i get an error when report opens.

    Data field 'marks' not found

    but same SQL works without MAX function

    please solve this

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: SQl problem

    Try...
    Code:
    Set rs = con.Execute("select MAX(marks) AS marks from StuMarks where srollno=21")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: SQl problem

    Great
    thank you so much Rob

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    No prob. Glad to help

    Ps, sorry for the delay
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    Quote Originally Posted by RobDog888
    No prob. Glad to help

    Ps, sorry for the delay
    hehehe
    there was no delay, you replied this and solved this problem within One minute

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    I know, was making fun at the instant response.


    Oh and btw the error was because when you use a calculation function like that it will change the field name as a result of its calculation like "MaxOfmarks" or such. So by aliasing it back to the original it will be found.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    yeah thats y i wrote hehehe in my previous post. please now don't make this thread up

  8. #8

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    oh please I'm sorry
    please tell me whats wrong in this query
    Code:
    Set rs = con.Execute("select name, MAX(marks) AS marks from StuMarks where srollno=21")

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Well when you use an aggrete function like MAX any other fields you include in the select list need to either be having some other aggrete function applied to it or just be included in a GROUP BY clause at the end of the query.

    Code:
    Set rs = con.Execute("select [name], MAX(marks) AS marks from StuMarks where srollno=21 GROUP BY [name]")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    my actual query is
    Code:
    Set rs = con.Execute("select [rollno], MAX(markoptained) as markoptained from markccc WHERE [session]= " & Text1.Text & "")
    and i get this error
    Code:
    you tried to execute a query that does not include the specified expression ' rollno' as part of an aggregate function

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Yup and you didnt add the rest of what I had wrote about the GROUP BY clause
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    can u pls tell me what to do next in this query?

  13. #13

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    it is showing now two records Rob
    and i want to show only one record
    Code:
    Set rs = con.Execute("select [rollno], MAX(markoptained) as markoptained from markccc WHERE [session]= " & Text1.Text & " Group by rollno")

  14. #14
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Is "rollno" unique between the two or are they the same. Can you post some example record data?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  15. #15

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    i have wrote the whole code in my #1 post
    and my table have only these three fields only
    rollno
    markoptained
    session

  16. #16
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    But you are not adding the extra fields to your select list as I have been mentioning like in post #9.

    For your other fields it would look like this.

    Code:
    Set rs = con.Execute("select rollno, markoptained, session, MAX(marks) AS marks from StuMarks where srollno=21 GROUP BY rollno, markoptained, session")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  17. #17

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    it is still showing me Two Records Rob
    Code:
    Set rs = con.Execute("select rollno, markoptained, [session], MAX(markoptained) AS markoptained from markccc where [session]= " & Text1.Text & " GROUP BY rollno, markoptained, [session]")

  18. #18

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    not only two records,
    it is showing all the records which fulfils the criteria

  19. #19
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Well Im not sure what the reason is as I cant see your resulting data. If its sensitive just post a relevant mock up. the query is right but without the data it is not known if its possible at all.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  20. #20

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    Rob,
    im upload the example, please click the button Report. when you run this example.
    i want only one record (MAX marks) to be shown but it is showing all the records
    Attached Files Attached Files

  21. #21
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Ok since you have the rollno field in there it is creating the multiple records because it cant be grouped by because there are no common values to group on. How are you going to group "4, 5, 7, 8"?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  22. #22

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    i just want to show the MAX marks and the rollno of its row.
    this is the requirement

  23. #23
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Im not sure what your rollno field is used for but if you have to show it you can show just the FIRST or LAST value as those are aggregete functions.

    This will give you one record as I think you may need.

    Code:
    Set rs = con.Execute("select FIRST(rollno) AS rollno, MAX(markoptained) AS markoptained from markccc where [session]= " & Text1.Text)
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  24. #24
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Quote Originally Posted by chunk
    i just want to show the MAX marks and the rollno of its row.
    this is the requirement
    You can not show just one row with the rollno field as I have previously posted the values in that field are not all the same so there is nothing to group them by when MAX the other field.

    What is it supossed to look like?

    4 - 425
    5 - 425
    7 - 425
    8 - 425

    ????

    You can not do that with a single sql call.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  25. #25

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    now this problem is solved.
    hehehe
    Thank you so much Rob

  26. #26

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    no not working,
    RollNo is not coming of the particular Row.

  27. #27
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Can you please post exactly how the record should look? Only you know how you are needing it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  28. #28

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    i want to show the Tooper(S) marks of Student in the report and his Roll No. only

  29. #29
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    What does that mean? Can you just post how the complete data should look?

    Code:
    rollno  |  markoptained
    ----------------------
    4          425

    Something like that.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  30. #30

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    rollno markoptained session
    4 299 201
    5 395 201
    6 465 205
    7 380 201
    8 258 201

    this is how data is saved in the table, the highest marks are 465. and output should be like

    rollno | markoptained
    ----------------------
    6 465

    because corrosponding rollno is 6

  31. #31
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: [RESOLVED] SQl problem

    It would be best if you learned other features of SQL yourself. http://sqlzoo.net/

  32. #32
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Ok, then that is easier as we can simply sort the table in descending order and limit its return to a single record which will be the maximum value for markoptianed.


    Code:
    Set rs = con.Execute("SELECT TOP 1 rollno, markoptained from markccc ORDER BY markoptained DESC")
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  33. #33
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Quote Originally Posted by leinad31
    It would be best if you learned other features of SQL yourself. http://sqlzoo.net/
    Most of it is just getting the communications correct. Having an example of how you want/need the results show alot more then one would think.

    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  34. #34
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: [RESOLVED] SQl problem

    Quote Originally Posted by RobDog888
    Most of it is just getting the communications correct. Having an example of how you want/need the results show alot more then one would think.

    For one problem, yes. But in the long run I lean towards "experience is the best teacher" mentality... examples are harder to understand without knowledge of the fundamentals, e.g. discussion on GROUP BY above.

  35. #35
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] SQl problem

    Well without going off topic, we can help best by showing them the correct path instead of posting a generic link and have them be totally lost.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  36. #36
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: [RESOLVED] SQl problem

    Quote Originally Posted by RobDog888
    Well without going off topic, we can help best by showing them the correct path instead of posting a generic link and have them be totally lost.
    I trust in his ability to decide which of the topics covered are relevant to his immediate and future needs.

  37. #37

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    now this is completly Resolved Rob

  38. #38

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2007
    Posts
    912

    Re: [RESOLVED] SQl problem

    Rob i'm so sorry,
    actully im too much disturb these days because i lost my girl friend, and she is going to marry some other guy, and my mind is not working properly. please forgive me because im making this thread up again

    please tell me what should be done in SQL, if there are two or more student who has same Top marks.

  39. #39
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: [RESOLVED] SQl problem

    Quote Originally Posted by chunk
    please tell me what should be done in SQL, if there are two or more student who has same Top marks.
    Largely depends on how you phrased your SQL, what you want to accomplish, and how your tables are structured... it's possible to return the tied records, its also possible to return just one (without going into technical details, just imagine that choice of record is up to the database), it may return an error in some joins or produce a cartesian result...

    So you see, rather than asking for help for each and every query, step back and familiarize yourself with the fundamentals.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width