Jump to content

mysql query


piyush23424

Recommended Posts

Hi,

 

i am using the following query to fetch records from the database

$q="select * from the list where address='%$searchString'";

 

The above query is fetching the matching results.

Now what i want is it should also fetch the other records having same city id as that of the resultant row.

city_id is a other column in the list table.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/192513-mysql-query/
Share on other sites

$q="select * from the list where address='%$searchString' and city_id=$citi_id";

 

Thanks for replying but you are taking my question in wrong way.

 

what i need is first it will find the result with address and then it will check the cityid of the resultant row. after that it will fetch all other records from list table having same cityid as that of resultant row's city id.

i know it can be done with nested select query but i don't know how to write that. ?

 

Link to comment
https://forums.phpfreaks.com/topic/192513-mysql-query/#findComment-1014388
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.