fetching value from related multiple rows & columns in PHP SQL [message #182521] |
Sat, 10 August 2013 05:50 |
vikas daiya
Messages: 2 Registered: August 2013
Karma: 0
|
Junior Member |
|
|
I have database as follows. using SQL, PHP
Code Period Period2 type amount
14 4 2013 TP 500
14 5 2013 TP 300
14 6 2013 TP 175
13 4 2013 TP 150
13 5 2013 TP 50
13 6 2013 TP 250
12 7 2013 TP 110
I want to create a form with combos having
which will fetch values as follows.
code > period > period2 > type > amount
14 > 4 > 2013 > TP > 500
and so on.... same need to be updated / inserted in new table.
note: amount is related to type which is related to period2 which is related to period under code.
means under code "14" there are three values "4,5,6" under this there is one value "2013" (default) and "TP" (default) and amount under this there are values "500,300,175" so when code is sleeted i.e "14" then values 4,5,6 should fetched and then "2013" then "TP" but when period is selected i.e 5 then amount of 5 300 should be fetched.
kindly help me out to solve this query.
|
|
|
Re: fetching value from related multiple rows & columns in PHP SQL [message #182523 is a reply to message #182521] |
Sat, 10 August 2013 12:04 |
Jerry Stuckle
Messages: 2598 Registered: September 2010
Karma: 0
|
Senior Member |
|
|
On 8/10/2013 1:50 AM, vikas daiya wrote:
> I have database as follows. using SQL, PHP
>
> Code Period Period2 type amount
> 14 4 2013 TP 500
> 14 5 2013 TP 300
> 14 6 2013 TP 175
> 13 4 2013 TP 150
> 13 5 2013 TP 50
> 13 6 2013 TP 250
> 12 7 2013 TP 110
>
>
> I want to create a form with combos having
>
> which will fetch values as follows.
>
> code > period > period2 > type > amount
>
> 14 > 4 > 2013 > TP > 500
>
> and so on.... same need to be updated / inserted in new table.
>
> note: amount is related to type which is related to period2 which is related to period under code.
>
> means under code "14" there are three values "4,5,6" under this there is one value "2013" (default) and "TP" (default) and amount under this there are values "500,300,175" so when code is sleeted i.e "14" then values 4,5,6 should fetched and then "2013" then "TP" but when period is selected i.e 5 then amount of 5 300 should be fetched.
>
> kindly help me out to solve this query.
>
This isn't a PHP question. You need to be asking in a SQL newsgroup,
or, more preferably, a newsgroup related to the database you are using.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex(at)attglobal(dot)net
==================
|
|
|