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.

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.