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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query SQL statement (ORDER BY) 1

Status
Not open for further replies.

jeevenze

Technical User
Mar 13, 2001
62
US
This question pertains really more to Ultra Dev but I've created the database in Microsoft Access.
I'm trying to obtain results where they are sorted by creation_date. This works fine in Access. However when I use the same SQL statment in Ultradev (I insert the line 'WHERE username='MM_Username' so the results are filtered according to the logged in user) I get the appropriate results but the data isn't ordered by the creation_date. Essentially the SQL syntax (below) seems right to me and I was wondering where I might have messed up.
Thank you in advance to anyone who helps me.

Jeevenze

SELECT tblticketinfo.ticket_number, tblticketinfo.name, tblticketinfo.short_title, tblticketinfo.status, tblticketinfo.severity, tblticketinfo.creation_date, Count(tblcommentslog.ticket_number) AS CountOfTicket_Number
FROM tblcommentslog RIGHT JOIN tblticketinfo ON tblcommentslog.ticket_number = tblticketinfo.ticket_number
WHERE username='MM_Username'
GROUP BY tblticketinfo.ticket_number, tblticketinfo.name, tblticketinfo.short_title, tblticketinfo.status, tblticketinfo.severity, tblticketinfo.creation_date
ORDER BY tblticketinfo.creation_date DESC;
 
Is this a string you are building? If this was coded in Access, or VB you would need to do the following:

"SELECT tblticketinfo.ticket_number, tblticketinfo.name,
tblticketinfo.short_title, tblticketinfo.status, tblticketinfo.severity,
tblticketinfo.creation_date, Count(tblcommentslog.ticket_number) AS
CountOfTicket_Number
FROM tblcommentslog RIGHT JOIN tblticketinfo ON
tblcommentslog.ticket_number = tblticketinfo.ticket_number
WHERE username='" & MM_Username & "'
GROUP BY tblticketinfo.ticket_number, tblticketinfo.name,
tblticketinfo.short_title, tblticketinfo.status, tblticketinfo.severity,
tblticketinfo.creation_date
ORDER BY tblticketinfo.creation_date DESC;"

It's basically WHERE username = singlequote doublequote & variable & doublequote singlequote.

Don't know if that is the Case in UltraDev, but worth a shot. Jim Lunde
compugeeks@hotmail.com
Custom Application Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top