Skip to Content.
Sympa Menu

freetds - Re: [RE: [freetds] SQL Query troubles]

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Steven Orton <sorton9999 AT usa.net>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Subject: Re: [RE: [freetds] SQL Query troubles]
  • Date: Thu, 08 Jan 2004 16:17:57 -0500

so far its occured with any client that uses the freeTDS driver and sends SQL
commands. So it happens using my client and OpenLink's odbctest application.
I can't see anything in my dump logfile that indicates an error condition (no
explicit ERROR indicater). It just hangs with the output log indicating it
sent the out packet and where it normally dumps the reply packet, there is
nothing. Is there any other "thing" I can use to see anything else?

steve---



brian AT bruns.com wrote:

> All this misses the point of course, which is that
> FreeTDS is oblivious to using DISTINCT or any other SQL
> construct. All it care about are the number and types
> of columns/rows coming back. This problem if it lies
> within FreeTDS should be reproducible with the simple
> "SELECT * from table1 where Target_ID=:C" (:C being
> some constant normally returned from the subquery.
>
> Perhaps some action within the application has left the
> TDS connection in a bizarre state. See if you can get
> this to reproduce on a smaller scale maybe? (that is,
> cut the code down to the barest essentials while having
> it still fail).
>
> Brian
>
> On Thu, 08 Jan 2004 11:18:42 -0800, Michael Peppler
> wrote:
>
> >
> > On Thu, 2004-01-08 at 11:08, Lowden, James K wrote:
> > > > From: Steven Orton [mailto:sorton9999 AT usa.net]
> > > > Sent: January 8, 2004 1:57 PM
> > > >
> > > > I seem to be having problems with the following
> > query:
> > > >
> > > > SELECT * FROM table1 WHERE Target_ID=(SELECT
> > DISTINCT
> > > > Target_ID FROM table2
> > > > WHERE PlatformTypeID=62 AND db_ctx_id=3)
> > >
> > > It's not a good idea to rely on a subquery returning
> > only one row to a point
> > > evaluation. How do you expect the server to cope if
> > it returns two
> > > (distinct) Target_IDs?
> > >
> > > I would do:
> > >
> > > SELECT * FROM table1
> > > WHERE Target_ID in (
> > > SELECT DISTINCT Target_ID
> > > FROM table2
> > > WHERE PlatformTypeID=62
> > > AND db_ctx_id=3
> > > )
> >
> > In general using a join rather than a sub-query gets
> > better performance:
> >
> > select *
> > from table1 t1
> > , table2 t2
> > where t1.TargetID = t2.TargetID
> > and t2.PlatformTypeID = 62
> > and t2.db_ctx_id = 3
> >
> > Michael
> > --
> > Michael Peppler Data
> > Migrations, Inc.
> > mpeppler AT peppler.org
> > http://www.mbay.net/~mpeppler
> > Sybase T-SQL/OpenClient/OpenServer/C/Perl developer
> > available for short or
> > long term contract positions -
> > http://www.mbay.net/~mpeppler/resume.html
> > _______________________________________________
> > FreeTDS mailing list
> > FreeTDS AT lists.ibiblio.org
> > http://lists.ibiblio.org/mailman/listinfo/freetds
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>



-------------------------------
Steven Orton
sorton9999 AT usa.net
--
"Put your hand on a hot stove for a minute,
and it seems like an hour.
Sit with a pretty girl for an hour, and it
seems like a minute. THAT'S relativity."
-- Albert Einstein
-------------------------------






Archive powered by MHonArc 2.6.24.

Top of Page