Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.