Solved

Need Desperate help...Stuck badly

Posted on 2008-10-15
3
167 Views
Last Modified: 2010-03-19
i am running a query in sql server 2005

There are 2 tables one is Table_1 and other is Tabe_5
when i select the terms individually like select trailer_1 from Table_5 with the same condition,
i get 15 rows of data,
but when i introduce the factor of trade_quantity there
i takes all the rows of Table_1(14451 rows) and multiplies them with 15
can you please suggest a solution at the earliest as i have to give this kind of queries by tomorrow morning and i am completely stuck here
code is below
select t1.trade_quantity,t5.trailer_1 from Table_1 t1,Table_5 t5 where ((t5.account_no like '4W7G%') and (t5.trailer_1 like '%5%5'))

Open in new window

0
Comment
Question by:project_dev
  • 2
3 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 22726558
how are the rows of the 2 tables related?
there seems no condition set up between the 2, so either you are missing that, or it should actually be a UNION query?
0
 

Author Comment

by:project_dev
ID: 22726592
the two tables are connected through a row_count variable
0
 

Author Comment

by:project_dev
ID: 22726608
thanks dude
your idea just struck me,
i was not comparing the row count of the two.
you saved the day man....
thanks a lot...
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

743 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now