SitePoint Sponsor |
|
User Tag List
Results 1 to 6 of 6
Thread: Query Problem
-
May 14, 2009, 06:43 #1
- Join Date
- Apr 2009
- Posts
- 50
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Query Problem
What is wrong in this code
Code MySQL:$query = "SELECT ledger.bill_no,ledger.ref_no,ledger.bill_date,ledger.insurers,ledger.issuing_office,ledger.insured_name,ledger.vehicle_no,ledger.vehicle,ledger.type_of_report,sfb.insured_address,sfb.prof_fees,sfb.prof_fees_desc,sfb.photos_nos,sfb.photos,sfb.conveyance_desc,sfb.conveyance,sfb.halting_desc,sfb.halting,sfb.misc_desc,sfb.misc,sfb.total,sfb.service_tax_rate,sfb.service_tax,sfb.survey_fees,sfb.in_words,sfb.remarks FROM ledger,sfb WHERE ledger.bill_no='$bill_no' AND sfb.bill_no='$bill_no'";
-
May 14, 2009, 06:50 #2
Why? Do you get an error? A result you didn't expect?
Guido - Community Team Leader
The Votes Are In: The Winners of the 2013 Community Awards are...
Blog - Free Flash Slideshow Widget
-
May 14, 2009, 07:02 #3
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
what's
wrong?
you
mean,
other
than
the
fact
that
the
query
is
all
strung
out
on
a
single
humoungously
long
line
which
makes
it
almost
impossible
for
a
human
being
to
read
and
understand?
-
May 14, 2009, 07:12 #4
- Join Date
- Apr 2009
- Posts
- 50
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
ohh...
I changed the query to
HTML Code:SELECT ledger.bill_no,ledger.ref_no,ledger.bill_date,ledger.insurers,ledger.issuing_office, ledger.insured_name,ledger.vehicle_no,ledger.vehicle,ledger.type_of_report,sfb.insured_address, sfb.prof_fees,sfb.prof_fees_desc,sfb.photos_nos,sfb.photos,sfb.conveyance_desc,sfb.conveyance, sfb.halting_desc,sfb.halting,sfb.misc_desc,sfb.misc,sfb.total,sfb.service_tax_rate,sfb.service_tax, sfb.survey_fees,sfb.in_words,sfb.remarks FROM ledger INNER JOIN sfb ON ledger.bill_no=sfb.bill_no WHERE ledger.bill_no='$bill_no'";
-
May 14, 2009, 07:27 #5
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
it's gotta be a data problem, your join is fine
-
May 14, 2009, 07:37 #6
- Join Date
- Apr 2009
- Posts
- 50
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
thanks Mr r937, yeah i got the solution. I was becoz of difference between # of rows in both tables. I sorted out the problem. Now in both tables I have same number of rows 73 record in boths tables & now the query is working fyn
Bookmarks