Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

retrieve records 1

Status
Not open for further replies.

meenakshidhar

Programmer
Joined
Oct 19, 2001
Messages
77
Location
MY
Hi Friends,
I am having one table...
id tag code
-------------
1 1 A
2 1 B
3 1 C
4 1 D
5 0
6 0
7 0
8 0
9 0
10 0
11 0
12 0

i want to select say top 4 records where tag=0 using php...
and then update those records in the same above table,so after updation the table should be like this....

id tag code
--------------
1 1 A
2 1 B
3 1 C
4 1 D
5 1 E
6 1 F
7 1 G
8 1 H
9 0
10 0
11 0
12 0

Can anybody please help me out...this is urgent...

Regards
Meenakshi Dhar
 
Hi,

Not quite sure what you mean...

How do you determine/identify the top 4 records?

Best Regards


Jakob
 
i mean i want to select say 4/5/6 records from this table where tag=0..it can be any 4 records but only those whose tag=0..and then update the same as i mentioned above...
 
update table
set tag=1
where id in (select id from table where tag=0 order by id limit 4)

something like this ??
 
thanks a lot hos2...this is what i exactly want...
 
ah but now I see that you also have E,F,G,H. where are those values coming from ???

 
these values are actually coming from 'session userid'...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top