|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Any way to query a query?
i want to query a query, like i want to make one query and get the result form that query and query the result of that query, is this possible with mysql?
if so, how? |
|
#2
|
|||
|
|||
|
RE: Any way to query a query?
Well, since PHP 4.0.x you can use subqueries, you can also make a temporary table, but it's far easiest by just combining the queries with AND:
1st query: SELECT * FROM table WHERE category_id=213; 2nd query: SELECT * FROM would_be_results_from_1st_query WHERE price<100; combined: SELECT * FROM table WHERE category_id=213 AND price<100; |
|
#3
|
|||
|
|||
|
RE: Any way to query a query?
yeah thats easy, but i have a query that needs to be done in 2 steps in order to come out right or it will give incorrect results, darn complex fricken query involving 4 tables.
I gotta select a whole mass of records with 4 criteria, group them and then sum the results of 14 fields, will take 2 queries or a temp table. I'd rather not use a temp table if i can only query a query somehow. |
|
#4
|
|||
|
|||
|
RE: Any way to query a query?
Please post some details
|
|
#5
|
|||
|
|||
|
RE: Any way to query a query?
think i will just leave it the way it is, it works, but not 100% efficient.
Too hard to post what you want, theres just not enough room in this forum for it and it wont make sense as it will be too scrambled, the tables are massive, got 30-40 columns and returns about varying amount of records from anything from 10 to 300 depending on how many people are in there and then sums them all grouping on id which is the persons name from another table with about 20 columns. I was just wanting a small example if what im asking was possible so i could port it into my larger scale problem. Thought it was easier than this. later... |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Any way to query a query? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|