|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
mySQL problem
Hi,
I have some mysql problems here is an example table Postings pid mid comments 1 1 hi 2 1 bye 3 2 " " pid is a primary key here is the othe table: Timslot id pid comment 1 1 hi 2 1 hi 3 3 " " pid here is a reference to pid in Postings Here is the functions I use: What this does is gets pid 1, when I really want is pid 2. How can I do this so table Timeslot would look like this: Timslot id pid comment 1 1 hi 2 2 bye 3 3 " " Thanks. |
|
#2
|
|||
|
|||
|
RE: mySQL problem
It's really unclear what you want to do. Can you please explain what is it the tables contain, what is mid, etc.
|
|
#3
|
|||
|
|||
|
RE: mySQL problem
mid is short for member id.
pid is short for posting id. It's just that when I query the Posting table for pid's under a certian mid, (ie. mid 1) I'll will get pid 1, when I really want pid 2. |
|
#4
|
|||
|
|||
|
RE: mySQL problem
So you want the latest posting from a member or what? "I want 2 but not 1" isn't telling us much
|
|
#5
|
|||
|
|||
|
RE: mySQL problem
Yes, the lastest polling is correct.
|
|
#6
|
|||
|
|||
|
RE: mySQL problem
use the following query:
SELECT Max(pid) FROM ta_posting WHERE mid = '$mid'" this will always return the largest value of PID for a given MID |
|
#7
|
|||
|
|||
|
RE: mySQL problem
select * from posting where mid=1 order by pid desc
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > mySQL problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|