Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help with SQL syntax.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I'm still learning elementary VBA SQL coding syntax. But I'm not really clear on how Group By and Order By should appear in an SQL line. The code below is a sampling of the code that I am using. Could someone give me an example of how the GROUP BY and ORDER BY statments should be added (should they be inside or outside of the parenthesis, etc...)

Set Rs = Db.OpenRecordset("SELECT [Table Name].*
FROM [Table Name]
HAVING (([Table Name].Date
Between Eval('[Beginning Date]')
And Eval('[Ending Date]')))")
 
The "standard" clause sequence is
SELECT list of fields
FROM list of tables (with JOINS etc)
WHERE selection ctriteria
GROUP BY list of fields
HAVING selection criteria of grouping
ORDER BY list of fields
Parentheses are used within each clause.
Hope this helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top