0

Hi i have a table called hospitails. the table structure is as below

**Hospitals:-**
Hospital_id    Bigint
name            varchar(45)
city_id          bigint
district_id     bigint
state_id       bigint

now i need to search hospitals based on name,city_id,district_id,state_id. the query must cntain all the 4 fields.

when user does not provide any of the value all the hospitals with all the names from all the cites,districts,states has to be listed.
when user provides partial name and ignores the rest of the three fileds, it has to provide all the hospitals that starts with that name from all cities,districts,states,
when user ignores the other 3 fields and provides the city_id then all the hospitals should be listed from that city

Like wise.

for varchar columns if we apply 'like' then it does this kind of things but how to do this when there are bigint columns?

I need this query. please help.

2
Contributors
1
Reply
19
Views
2 Years
Discussion Span
Last Post by pclfw
0

Just use

SELECT * FROM Hospitals WHERE city_id = $input

This will return all of thew rows where the CITY_ID is the same as the input value.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.