Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Sql query, is there a  more efficient way to write this

Posted on 2005-05-09
2
Medium Priority
?
160 Views
Last Modified: 2010-03-19
Is there a more efficient way to write this query?

<CFQUERY NAME="mailregister" DATASOURCE="register">
SELECT distinct register.name, register.odate, register.ipregister, register.fname, register.lname, register.email, register.logname, register.passwd, register.acceptp, register.seqid, register.searchb1, register.searchb2, register.searchb3, register.searchb4, register.searcha1, register.searcha2, register.searcha3, register.searcha4 from register, responselog
where register.logname=responselog.sentto and responselog.datesent = '#url.datesent#' and responselog.responsetype = 'TW' and register.acceptp = 'Yes' and responselog.readmessage = 'No'
</CFQUERY>
0
Comment
Question by:ondrejko1
2 Comments
 
LVL 28

Accepted Solution

by:
rafrancisco earned 248 total points
ID: 13963779
Try this:

SELECT distinct register.name, register.odate, register.ipregister, register.fname, register.lname,
       register.email, register.logname, register.passwd, register.acceptp, register.seqid, register.searchb1,
       register.searchb2, register.searchb3, register.searchb4, register.searcha1, register.searcha2, register.searcha3,
       register.searcha4
from register inner join responselog
                   on register.logname=responselog.sentto and
                      responselog.datesent = '#url.datesent#' and
                      responselog.responsetype = 'TW' and
                      register.acceptp = 'Yes' and
                      responselog.readmessage = 'No'
0
 
LVL 14

Assisted Solution

by:Renante Entera
Renante Entera earned 252 total points
ID: 13966025
Hi ondrejko1!

You can also try this one :

<CFQUERY NAME="mailregister" DATASOURCE="register">
SELECT distinct register.name, register.odate, register.ipregister, register.fname, register.lname, register.email, register.logname, register.passwd, register.acceptp, register.seqid, register.searchb1, register.searchb2, register.searchb3, register.searchb4, register.searcha1, register.searcha2, register.searcha3, register.searcha4
FROM register
INNER JOIN responselog
  ON responselog.sentto = register.logname AND responselog.datesent = '#url.datesent#' AND responselog.responsetype = 'TW' AND responselog.readmessage = 'No'
WHERE register.acceptp = 'Yes'
</CFQUERY>

Hope this helps you.  Just try it.


Goodluck!
eNTRANCE2002 :-)
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question